Skip to content

Commit 1949020

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) (cherry picked from commit b45a2ad)
1 parent 2f87390 commit 1949020

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

Lines changed: 1 addition & 0 deletions
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

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

0 commit comments

Comments
 (0)