File tree 5 files changed +16
-8
lines changed
5 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ Flag | `--dev` | `--prod`
81
81
` --sourcemaps ` | ` true ` | ` false `
82
82
` --extract-css ` | ` false ` | ` true `
83
83
` --named-chunks ` | ` true ` | ` false `
84
+ ` --build-optimizer ` | ` false ` | ` true ` in Angular 5+
84
85
85
86
` --extract-licenses ` Extract all licenses in a separate file, in the case of production builds only.
86
87
` --i18n-file ` Localization file to use for i18n.
@@ -353,7 +354,7 @@ Note: service worker support is experimental and subject to change.
353
354
<code>--build-optimizer</code>
354
355
</p >
355
356
<p >
356
- (Experimental) Enables @angular-devkit/build-optimizer optimizations when using `--aot`.
357
+ Enables @angular-devkit/build-optimizer optimizations when using `--aot`.
357
358
</p >
358
359
</details >
359
360
Original file line number Diff line number Diff line change 41
41
},
42
42
"homepage" : " https://github.com/angular/angular-cli" ,
43
43
"dependencies" : {
44
- "@angular-devkit/build-optimizer" : " ~0.0.23 " ,
44
+ "@angular-devkit/build-optimizer" : " ~0.0.28 " ,
45
45
"@angular-devkit/schematics" : " ~0.0.25" ,
46
46
"@schematics/angular" : " ~0.0.38" ,
47
47
"autoprefixer" : " ^6.5.3" ,
Original file line number Diff line number Diff line change @@ -166,9 +166,7 @@ export const baseBuildCommandOptions: any = [
166
166
{
167
167
name : 'build-optimizer' ,
168
168
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`.'
172
170
} ,
173
171
{
174
172
name : 'named-chunks' ,
Original file line number Diff line number Diff line change
1
+ import { AngularCompilerPlugin } from '@ngtools/webpack' ;
1
2
import { readTsconfig } from '../utilities/read-tsconfig' ;
2
3
const webpackMerge = require ( 'webpack-merge' ) ;
3
4
import { CliConfig } from './config' ;
@@ -94,7 +95,8 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
94
95
sourcemaps : true ,
95
96
extractCss : false ,
96
97
namedChunks : true ,
97
- aot : false
98
+ aot : false ,
99
+ buildOptimizer : false
98
100
} ,
99
101
production : {
100
102
environment : 'prod' ,
@@ -106,7 +108,14 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
106
108
}
107
109
} ;
108
110
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 ) ;
110
119
}
111
120
112
121
// Fill in defaults from .angular-cli.json
Original file line number Diff line number Diff line change 27
27
},
28
28
"homepage" : " https://github.com/angular/angular-cli" ,
29
29
"dependencies" : {
30
- "@angular-devkit/build-optimizer" : " ~0.0.18 " ,
30
+ "@angular-devkit/build-optimizer" : " ~0.0.28 " ,
31
31
"@angular-devkit/schematics" : " ~0.0.25" ,
32
32
"@ngtools/json-schema" : " 1.1.0" ,
33
33
"@ngtools/webpack" : " 1.8.0-rc.0" ,
You can’t perform that action at this time.
0 commit comments