Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): always use ECMA 5 optimizations w…
Browse files Browse the repository at this point in the history
…ith 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
  • Loading branch information
clydin authored and vikerman committed Sep 19, 2019
1 parent c6ca77f commit 4d1944c
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -332,11 +332,14 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
}
}

// TODO: Investigate why this fails for some packages: wco.supportES2015 ? 6 : 5;
const terserEcma = 5;

const terserOptions = {
warnings: !!buildOptions.verbose,
safari10: true,
output: {
ecma: wco.supportES2015 ? 6 : 5,
ecma: terserEcma,
comments: false,
webkit: true,
},
Expand All @@ -345,12 +348,12 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
compress:
buildOptions.platform == 'server'
? {
ecma: wco.supportES2015 ? 6 : 5,
ecma: terserEcma,
global_defs: angularGlobalDefinitions,
keep_fnames: true,
}
: {
ecma: wco.supportES2015 ? 6 : 5,
ecma: terserEcma,
pure_getters: buildOptions.buildOptimizer,
// PURE comments work best with 3 passes.
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
Expand Down

0 comments on commit 4d1944c

Please sign in to comment.