Skip to content

Commit 5bdd1cb

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular-devkit/build-angular): enable babel build optimizer passes for ES2015+ targets
The new babel-based build optimizer passes are now enabled when targetting ES2015 and higher. ES5 targets will currently continue to use the previous build optimizer. ES5 support will require additional refactoring of the downlevelling process as the new build optimizer passes are designed for ES2015 code.
1 parent f277d95 commit 5bdd1cb

File tree

1 file changed

+2
-1
lines changed
  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

+2
-1
lines changed

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
296296
}
297297

298298
let buildOptimizerUseRule: RuleSetRule[] = [];
299-
if (buildOptions.buildOptimizer) {
299+
if (buildOptions.buildOptimizer && wco.scriptTarget < ScriptTarget.ES2015) {
300300
extraPlugins.push(new BuildOptimizerWebpackPlugin());
301301
buildOptimizerUseRule = [
302302
{
@@ -460,6 +460,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
460460
cacheDirectory: findCachePath('babel-webpack'),
461461
scriptTarget: wco.scriptTarget,
462462
aot: buildOptions.aot,
463+
optimize: buildOptions.buildOptimizer && wco.scriptTarget >= ScriptTarget.ES2015,
463464
},
464465
},
465466
...buildOptimizerUseRule,

0 commit comments

Comments
 (0)