Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): use GLOBAL_DEFS_FOR_TERSER_WITH_A…
Browse files Browse the repository at this point in the history
…OT if present

Fix #15206
  • Loading branch information
filipesilva authored and Keen Yee Liau committed Aug 6, 2019
1 parent d212620 commit 284de6c
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,22 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
ngI18nClosureMode: false,
};

try {
// Try to load known global definitions from @angular/compiler-cli.
// tslint:disable-next-line:no-implicit-dependencies
const GLOBAL_DEFS_FOR_TERSER = require('@angular/compiler-cli').GLOBAL_DEFS_FOR_TERSER;
if (GLOBAL_DEFS_FOR_TERSER) {
angularGlobalDefinitions = GLOBAL_DEFS_FOR_TERSER;
// Try to load known global definitions from @angular/compiler-cli.
const GLOBAL_DEFS_FOR_TERSER = require('@angular/compiler-cli').GLOBAL_DEFS_FOR_TERSER;
if (GLOBAL_DEFS_FOR_TERSER) {
angularGlobalDefinitions = GLOBAL_DEFS_FOR_TERSER;
}

if (buildOptions.aot) {
// Also try to load AOT-only global definitions.
const GLOBAL_DEFS_FOR_TERSER_WITH_AOT =
require('@angular/compiler-cli').GLOBAL_DEFS_FOR_TERSER_WITH_AOT;
if (GLOBAL_DEFS_FOR_TERSER_WITH_AOT) {
angularGlobalDefinitions = {
...angularGlobalDefinitions,
...GLOBAL_DEFS_FOR_TERSER_WITH_AOT,
};
}
} catch {
// Do nothing, the default above will be used instead.
}

const terserOptions = {
Expand Down

0 comments on commit 284de6c

Please sign in to comment.