From bc7cde0f01d248ee0afec5a85efd365805f7a684 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 3 Dec 2019 08:47:12 +0000 Subject: [PATCH] fix(core): ensure that `ngI18nClosureMode` is guarded (#34211) If the `ngI18nClosureMode` global check actually makes it through to the runtime, then checks for its existence should be guarded to prevent `Reference undefined` errors in strict mode. (Normally, it is stripped out by dead code elimination during build optimization.) PR Close #34211 --- packages/core/src/application_module.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/application_module.ts b/packages/core/src/application_module.ts index 2030c63631..3f71df4468 100644 --- a/packages/core/src/application_module.ts +++ b/packages/core/src/application_module.ts @@ -49,7 +49,8 @@ export function _localeFactory(locale?: string): string { * * Ivy enabled: use `$localize.locale` */ export function getGlobalLocale(): string { - if (ngI18nClosureMode && typeof goog !== 'undefined' && goog.LOCALE !== 'en') { + if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode && + typeof goog !== 'undefined' && goog.LOCALE !== 'en') { // * The default `goog.LOCALE` value is `en`, while Angular used `en-US`. // * In order to preserve backwards compatibility, we use Angular default value over // Closure Compiler's one.