Skip to content

Commit c94a196

Browse files
committed
fix(@angular-devkit/build-angular): define forwardRef as a pure function
By configuring the optimizer (`terser`) to be aware that the Angular `forwardRef` helper function is a pure function, the optimizer can completely remove the helper call when the return value is unused.
1 parent d3afdcc commit c94a196

File tree

1 file changed

+1
-0
lines changed
  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
440440
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
441441
passes: buildOptions.buildOptimizer ? 3 : 1,
442442
global_defs: angularGlobalDefinitions,
443+
pure_funcs: ['forwardRef'],
443444
}),
444445
// We also want to avoid mangling on server.
445446
// Name mangling is handled within the browser builder

0 commit comments

Comments
 (0)