File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs Expand file tree Collapse file tree 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 {
297297 ngI18nClosureMode : false ,
298298 } ;
299299
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+ } ;
306315 }
307- } catch {
308- // Do nothing, the default above will be used instead.
309316 }
310317
311318 const terserOptions = {
You can’t perform that action at this time.
0 commit comments