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 committed Jul 31, 2019
1 parent 5df50ba commit 06cd333
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,23 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
// Do nothing, the default above will be used instead.
}

if (buildOptions.aot) {
// Also try to load AOT-only global definitions.
try {
// tslint:disable-next-line:no-implicit-dependencies
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.
}
}

const terserOptions = {
ecma: wco.supportES2015 ? 6 : 5,
warnings: !!buildOptions.verbose,
Expand Down

0 comments on commit 06cd333

Please sign in to comment.