Skip to content

Commit df6d331

Browse files
filipesilvahansl
authored andcommitted
fix(@angular/cli): use 3 uglify passes with build-optimizer
PURE comments work best with 3 passes. See webpack/webpack#2899 (comment) for context and an example. Thanks to @kzc for highlighting this.
1 parent a8d3806 commit df6d331

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/@angular/cli/models/webpack-configs/production.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ export const getProdConfig = function (wco: WebpackConfigOptions) {
9898
// This plugin must be before webpack.optimize.UglifyJsPlugin.
9999
extraPlugins.push(new PurifyPlugin());
100100
uglifyCompressOptions.pure_getters = true;
101+
// PURE comments work best with 3 passes.
102+
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
103+
uglifyCompressOptions.passes = 3;
101104
}
102105

103106
return {

0 commit comments

Comments
 (0)