From 2c93a73b7a085651cb8b35ce3eb942299d99a220 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 21 Feb 2022 11:31:12 +0100 Subject: [PATCH] fix(@angular-devkit/build-angular): don't rename blocks which have a name When using the unsupported `webpackChunkName` magic comment we renamed the chunk which in some cases causes a runtime error. Closes #22525 --- .../build_angular/src/webpack/plugins/named-chunks-plugin.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/angular_devkit/build_angular/src/webpack/plugins/named-chunks-plugin.ts b/packages/angular_devkit/build_angular/src/webpack/plugins/named-chunks-plugin.ts index feb0e5d208e4..3390682c5bf4 100644 --- a/packages/angular_devkit/build_angular/src/webpack/plugins/named-chunks-plugin.ts +++ b/packages/angular_devkit/build_angular/src/webpack/plugins/named-chunks-plugin.ts @@ -41,6 +41,11 @@ export class NamedChunksPlugin { continue; } + if (block.groupOptions.name) { + // Ignore groups which have been named already. + return undefined; + } + for (const dependency of block.dependencies) { if (dependency instanceof ImportDependency) { return Template.toPath(dependency.request);