Skip to content

Commit

Permalink
fix(core): set ngDevMode to false when calling enableProdMode() (
Browse files Browse the repository at this point in the history
…#40124)

The `ngDevMode` description also mentions that calling `enableProdMode` will set this the value to `false`.
https://github.com/angular/angular/blob/4610093c87975b6355f31a9c849351129908783a/packages/core/src/util/ng_dev_mode.ts#L22 which is currently not the case.

PR Close #40124
  • Loading branch information
alan-agius4 authored and alxhub committed Dec 16, 2020
1 parent 47d9b6d commit 70b4816
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/util/is_dev_mode.ts
Expand Up @@ -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`.
*
Expand Down Expand Up @@ -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;
}

0 comments on commit 70b4816

Please sign in to comment.