fix(core): set `ngDevMode` to `false` when calling `enableProdMode()` (#40124)

The `ngDevMode` description also mentions that calling `enableProdMode` will set this the value to `false`.
4610093c87/packages/core/src/util/ng_dev_mode.ts (L22) which is currently not the case.

PR Close #40124
This commit is contained in:
Alan Agius 2020-12-15 11:04:47 +01:00 committed by Alex Rickabaugh
parent 47d9b6d72d
commit 70b4816cd5
1 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {global} from './global';
/**
* This file is used to control if the default rendering pipeline should be `ViewEngine` or `Ivy`.
*
@ -44,5 +46,12 @@ export function enableProdMode(): void {
if (_runModeLocked) {
throw new Error('Cannot enable prod mode after platform setup.');
}
// The below check is there so when ngDevMode is set via terser
// `global['ngDevMode'] = false;` is also dropped.
if (typeof ngDevMode === undefined || !!ngDevMode) {
global['ngDevMode'] = false;
}
_devMode = false;
}