From 2772eea649fe88e3e530e77a60f34c05f0ea0092 Mon Sep 17 00:00:00 2001 From: Ramesh Thiruchelvam Date: Thu, 18 Nov 2021 22:51:09 +0530 Subject: [PATCH] refactor(core): clean up isDevMode for tree-shaking (#44210) Removing the usage of isDevMode with ngDevMode flag. This will make the dev-mode code tree-shakable from the production builds. PR Close #44210 --- packages/upgrade/src/dynamic/src/upgrade_adapter.ts | 4 ++-- packages/upgrade/static/src/upgrade_module.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/upgrade/src/dynamic/src/upgrade_adapter.ts b/packages/upgrade/src/dynamic/src/upgrade_adapter.ts index beb411505fe..3e89a11880e 100644 --- a/packages/upgrade/src/dynamic/src/upgrade_adapter.ts +++ b/packages/upgrade/src/dynamic/src/upgrade_adapter.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Compiler, CompilerOptions, Injector, isDevMode, NgModule, NgModuleRef, NgZone, resolveForwardRef, StaticProvider, Testability, Type} from '@angular/core'; +import {Compiler, CompilerOptions, Injector, NgModule, NgModuleRef, NgZone, resolveForwardRef, StaticProvider, Testability, Type} from '@angular/core'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {bootstrap, element as angularElement, IAngularBootstrapConfig, IAugmentedJQuery, IInjectorService, IModule, IProvideService, IRootScopeService, ITestabilityService, module_ as angularModule} from '../../common/src/angular1'; @@ -605,7 +605,7 @@ export class UpgradeAdapter { let subscription = this.ngZone.onMicrotaskEmpty.subscribe({ next: () => { if (rootScope.$$phase) { - if (isDevMode()) { + if (typeof ngDevMode === 'undefined' || ngDevMode) { console.warn( 'A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone.'); } diff --git a/packages/upgrade/static/src/upgrade_module.ts b/packages/upgrade/static/src/upgrade_module.ts index 24a87ae37e8..8b05f8f0edb 100644 --- a/packages/upgrade/static/src/upgrade_module.ts +++ b/packages/upgrade/static/src/upgrade_module.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injector, isDevMode, NgModule, NgZone, PlatformRef, Testability} from '@angular/core'; +import {Injector, NgModule, NgZone, PlatformRef, Testability} from '@angular/core'; import {bootstrap, element as angularElement, IInjectorService, IIntervalService, IProvideService, ITestabilityService, module_ as angularModule} from '../../src/common/src/angular1'; import {$$TESTABILITY, $DELEGATE, $INJECTOR, $INTERVAL, $PROVIDE, INJECTOR_KEY, LAZY_MODULE_REF, UPGRADE_APP_TYPE_KEY, UPGRADE_MODULE_NAME} from '../../src/common/src/constants'; @@ -279,7 +279,7 @@ export class UpgradeModule { setTimeout(() => { const subscription = this.ngZone.onMicrotaskEmpty.subscribe(() => { if ($rootScope.$$phase) { - if (isDevMode()) { + if (typeof ngDevMode === 'undefined' || ngDevMode) { console.warn( 'A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone.'); }