Skip to content

Commit 9bcf7a9

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. (cherry picked from commit c94a196)
1 parent 495bf64 commit 9bcf7a9

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
@@ -428,6 +428,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
428428
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
429429
passes: buildOptions.buildOptimizer ? 3 : 1,
430430
global_defs: angularGlobalDefinitions,
431+
pure_funcs: ['forwardRef'],
431432
}),
432433
// We also want to avoid mangling on server.
433434
// Name mangling is handled within the browser builder

0 commit comments

Comments
 (0)