Skip to content

Commit 4d1944c

Browse files
clydinvikerman
authored andcommitted
fix(@angular-devkit/build-angular): always use ECMA 5 optimizations with terser
There appears to be defects related to terser's ECMA 6 options. The optimizations present a minima size improvement in general. Further investigation is required to determine the underlying cause within terser. Fixes #15580
1 parent c6ca77f commit 4d1944c

File tree

1 file changed

+6
-3
lines changed
  • packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs

1 file changed

+6
-3
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,14 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
332332
}
333333
}
334334

335+
// TODO: Investigate why this fails for some packages: wco.supportES2015 ? 6 : 5;
336+
const terserEcma = 5;
337+
335338
const terserOptions = {
336339
warnings: !!buildOptions.verbose,
337340
safari10: true,
338341
output: {
339-
ecma: wco.supportES2015 ? 6 : 5,
342+
ecma: terserEcma,
340343
comments: false,
341344
webkit: true,
342345
},
@@ -345,12 +348,12 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
345348
compress:
346349
buildOptions.platform == 'server'
347350
? {
348-
ecma: wco.supportES2015 ? 6 : 5,
351+
ecma: terserEcma,
349352
global_defs: angularGlobalDefinitions,
350353
keep_fnames: true,
351354
}
352355
: {
353-
ecma: wco.supportES2015 ? 6 : 5,
356+
ecma: terserEcma,
354357
pure_getters: buildOptions.buildOptimizer,
355358
// PURE comments work best with 3 passes.
356359
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.

0 commit comments

Comments
 (0)