File tree 1 file changed +15
-8
lines changed
packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs
1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -297,15 +297,22 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
297
297
ngI18nClosureMode : false ,
298
298
} ;
299
299
300
- try {
301
- // Try to load known global definitions from @angular /compiler-cli.
302
- // tslint:disable-next-line:no-implicit-dependencies
303
- const GLOBAL_DEFS_FOR_TERSER = require ( '@angular/compiler-cli' ) . GLOBAL_DEFS_FOR_TERSER ;
304
- if ( GLOBAL_DEFS_FOR_TERSER ) {
305
- angularGlobalDefinitions = GLOBAL_DEFS_FOR_TERSER ;
300
+ // Try to load known global definitions from @angular /compiler-cli.
301
+ const GLOBAL_DEFS_FOR_TERSER = require ( '@angular/compiler-cli' ) . GLOBAL_DEFS_FOR_TERSER ;
302
+ if ( GLOBAL_DEFS_FOR_TERSER ) {
303
+ angularGlobalDefinitions = GLOBAL_DEFS_FOR_TERSER ;
304
+ }
305
+
306
+ if ( buildOptions . aot ) {
307
+ // Also try to load AOT-only global definitions.
308
+ const GLOBAL_DEFS_FOR_TERSER_WITH_AOT =
309
+ require ( '@angular/compiler-cli' ) . GLOBAL_DEFS_FOR_TERSER_WITH_AOT ;
310
+ if ( GLOBAL_DEFS_FOR_TERSER_WITH_AOT ) {
311
+ angularGlobalDefinitions = {
312
+ ...angularGlobalDefinitions ,
313
+ ...GLOBAL_DEFS_FOR_TERSER_WITH_AOT ,
314
+ } ;
306
315
}
307
- } catch {
308
- // Do nothing, the default above will be used instead.
309
316
}
310
317
311
318
const terserOptions = {
You can’t perform that action at this time.
0 commit comments