From df6d331a59894194d417e0d41bf57bd787d1d70d Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Wed, 26 Jul 2017 15:51:55 +0100 Subject: [PATCH] fix(@angular/cli): use 3 uglify passes with build-optimizer PURE comments work best with 3 passes. See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926 for context and an example. Thanks to @kzc for highlighting this. --- packages/@angular/cli/models/webpack-configs/production.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/@angular/cli/models/webpack-configs/production.ts b/packages/@angular/cli/models/webpack-configs/production.ts index 4e574f7428d2..cf75534ab913 100644 --- a/packages/@angular/cli/models/webpack-configs/production.ts +++ b/packages/@angular/cli/models/webpack-configs/production.ts @@ -98,6 +98,9 @@ export const getProdConfig = function (wco: WebpackConfigOptions) { // This plugin must be before webpack.optimize.UglifyJsPlugin. extraPlugins.push(new PurifyPlugin()); uglifyCompressOptions.pure_getters = true; + // PURE comments work best with 3 passes. + // See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926. + uglifyCompressOptions.passes = 3; } return {