Skip to content

Commit 9a9939f

Browse files
filipesilvaalexeagle
authored andcommitted
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. Closes #9231, #11439, #12096, #12128.
1 parent adf46c2 commit 9a9939f

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
@@ -263,25 +263,16 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
263263
comments: false,
264264
webkit: true,
265265
},
266-
267-
// On server, we don't want to compress anything. We still set the ngDevMode = false for it
268-
// to remove dev code, and ngI18nClosureMode to remove Closure compiler i18n code
269-
compress: (buildOptions.platform == 'server' ? {
266+
compress: {
267+
// PURE comments work best with 3 passes.
268+
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
269+
passes: 3,
270270
global_defs: {
271271
ngDevMode: false,
272272
ngI18nClosureMode: false,
273273
},
274-
} : {
275-
pure_getters: buildOptions.buildOptimizer,
276-
// PURE comments work best with 3 passes.
277-
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
278-
passes: buildOptions.buildOptimizer ? 3 : 1,
279-
global_defs: {
280-
ngDevMode: false,
281-
ngI18nClosureMode: false,
282-
},
283-
}),
284-
// We also want to avoid mangling on server.
274+
},
275+
// We want to avoid mangling on server.
285276
...(buildOptions.platform == 'server' ? { mangle: false } : {}),
286277
};
287278

0 commit comments

Comments
 (0)