diff --git a/integration/side-effects/snapshots/core/esm2015.js b/integration/side-effects/snapshots/core/esm2015.js index d12748503d..13a1af3941 100644 --- a/integration/side-effects/snapshots/core/esm2015.js +++ b/integration/side-effects/snapshots/core/esm2015.js @@ -12,6 +12,6 @@ const __global = "undefined" !== typeof global && global; const _global = __globalThis || __global || __window || __self; -if (ngDevMode) _global.$localize = _global.$localize || function() { +if ("undefined" !== typeof ngDevMode && ngDevMode) _global.$localize = _global.$localize || function() { throw new Error("It looks like your application or one of its dependencies is using i18n.\n" + "Angular 9 introduced a global `$localize()` function that needs to be loaded.\n" + "Please run `ng add @angular/localize` from the Angular CLI.\n" + "(For non-CLI projects, add `import '@angular/localize/init';` to your `polyfills.ts` file.\n" + "For server-side rendering applications add the import to your `main.server.ts` file.)"); }; diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index 019394da77..b59aabbbe1 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -38,7 +38,7 @@ export {Sanitizer} from './sanitization/sanitizer'; export * from './codegen_private_exports'; import {global} from './util/global'; -if (ngDevMode) { +if (typeof ngDevMode !== 'undefined' && ngDevMode) { // This helper is to give a reasonable error message to people upgrading to v9 that have not yet // installed `@angular/localize` in their app. // tslint:disable-next-line: no-toplevel-property-access