Skip to content

Commit b45a2ad

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular-devkit/build-angular): when optimizing don't wrap function arguments in parenthesis
With this change function and arrow function arguments are not wrapped in parenthesis during the optimization phase. `wrap_func_args` which is enabled by default in terser will wrap function arguments in parenthesis. Recently this was also changed to wrap lamdas as well: terser/terser@66c3a5c An increase in bundle size was observed without this change. See: angular/angular#39432 (comment)
1 parent 661c0f2 commit b45a2ad

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/angular_devkit/build_angular/src/utils/process-bundle.ts

+1
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ async function terserMangle(
400400
ascii_only: true,
401401
webkit: true,
402402
beautify: shouldBeautify,
403+
wrap_func_args: false,
403404
},
404405
sourceMap:
405406
!!options.map &&

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

+1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
388388
comments: !buildOptions.extractLicenses && undefined,
389389
webkit: true,
390390
beautify: shouldBeautify,
391+
wrap_func_args: false,
391392
},
392393
// On server, we don't want to compress anything. We still set the ngDevMode = false for it
393394
// to remove dev code, and ngI18nClosureMode to remove Closure compiler i18n code

0 commit comments

Comments
 (0)