Skip to content

Commit 0f4cf19

Browse files
committed
fix(@angular-devkit/build-angular): remove pure_getters
When we first started using Build Optimizer, we saw a lot of the savings were tied to using the Uglify/Terser `pure_getters` option. This was intimately related with the structure and shape of the Angular codebase. The measurements we did at the time on angular.io showed a significant size reduction, from 1mb to about 600kb. Of these roughly 150kb were tied to using `pure_getters` if I remember correctly. Meanwhile the Angular codebase has changed significantly and I don't really see these savings anymore, so I don't think it makes sense to keep it on given that it is known to cause problems with some libraries. Related to #9231, #11439, #12096.
1 parent 86b23d7 commit 0f4cf19

File tree

1 file changed

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

1 file changed

+6
-15
lines changed

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

+6-15
Original file line numberDiff line numberDiff line change
@@ -257,25 +257,16 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
257257
comments: false,
258258
webkit: true,
259259
},
260-
261-
// On server, we don't want to compress anything. We still set the ngDevMode = false for it
262-
// to remove dev code, and ngI18nClosureMode to remove Closure compiler i18n code
263-
compress: (buildOptions.platform == 'server' ? {
260+
compress: {
261+
// PURE comments work best with 3 passes.
262+
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
263+
passes: 3,
264264
global_defs: {
265265
ngDevMode: false,
266266
ngI18nClosureMode: false,
267267
},
268-
} : {
269-
pure_getters: buildOptions.buildOptimizer,
270-
// PURE comments work best with 3 passes.
271-
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
272-
passes: buildOptions.buildOptimizer ? 3 : 1,
273-
global_defs: {
274-
ngDevMode: false,
275-
ngI18nClosureMode: false,
276-
},
277-
}),
278-
// We also want to avoid mangling on server.
268+
},
269+
// We want to avoid mangling on server.
279270
...(buildOptions.platform == 'server' ? { mangle: false } : {}),
280271
};
281272

0 commit comments

Comments
 (0)