File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ Flag | `--dev` | `--prod`
8181` --sourcemaps ` | ` true ` | ` false `
8282` --extract-css ` | ` false ` | ` true `
8383` --named-chunks ` | ` true ` | ` false `
84+ ` --build-optimizer ` | ` false ` | ` true ` with AOT and Angular 5
8485
8586` --extract-licenses ` Extract all licenses in a separate file, in the case of production builds only.
8687` --i18n-file ` Localization file to use for i18n.
@@ -353,7 +354,7 @@ Note: service worker support is experimental and subject to change.
353354 <code>--build-optimizer</code>
354355 </p >
355356 <p >
356- (Experimental) Enables @angular-devkit/build-optimizer optimizations when using `--aot`.
357+ Enables @angular-devkit/build-optimizer optimizations when using `--aot`.
357358 </p >
358359</details >
359360
Original file line number Diff line number Diff line change @@ -166,9 +166,7 @@ export const baseBuildCommandOptions: any = [
166166 {
167167 name : 'build-optimizer' ,
168168 type : Boolean ,
169- default : false ,
170- description : '(Experimental) Enables @angular-devkit/build-optimizer '
171- + 'optimizations when using `--aot`.'
169+ description : 'Enables @angular-devkit/build-optimizer optimizations when using `--aot`.'
172170 } ,
173171 {
174172 name : 'named-chunks' ,
Original file line number Diff line number Diff line change 1+ import { AngularCompilerPlugin } from '@ngtools/webpack' ;
12import { readTsconfig } from '../utilities/read-tsconfig' ;
23const webpackMerge = require ( 'webpack-merge' ) ;
34import { CliConfig } from './config' ;
@@ -94,7 +95,8 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
9495 sourcemaps : true ,
9596 extractCss : false ,
9697 namedChunks : true ,
97- aot : false
98+ aot : false ,
99+ buildOptimizer : false
98100 } ,
99101 production : {
100102 environment : 'prod' ,
@@ -106,7 +108,14 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
106108 }
107109 } ;
108110
109- return Object . assign ( { } , targetDefaults [ buildOptions . target ] , buildOptions ) ;
111+ const merged = Object . assign ( { } , targetDefaults [ buildOptions . target ] , buildOptions ) ;
112+
113+ // Use Build Optimizer on prod AOT builds by default when AngularCompilerPlugin is supported.
114+ const buildOptimizer = {
115+ buildOptimizer : merged . aot && AngularCompilerPlugin . isSupported ( )
116+ } ;
117+
118+ return Object . assign ( { } , buildOptimizer , merged ) ;
110119 }
111120
112121 // Fill in defaults from .angular-cli.json
You can’t perform that action at this time.
0 commit comments