diff --git a/packages/angular/build/src/builders/application/chunk-optimizer.ts b/packages/angular/build/src/builders/application/chunk-optimizer.ts
index 61ec816d46ba..7d7a6e56b829 100644
--- a/packages/angular/build/src/builders/application/chunk-optimizer.ts
+++ b/packages/angular/build/src/builders/application/chunk-optimizer.ts
@@ -302,7 +302,7 @@ export async function optimizeChunks(
minify: { mangle: false, compress: false },
sourcemap,
chunkFileNames: (chunkInfo) =>
- `${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/, '')}-[hash].js`,
+ `${chunkInfo.name.replace(/-[a-zA-Z0-9_-]{8}$/, '')}-[hash].js`,
});
optimizedOutput = result.output;
} else {
@@ -324,7 +324,7 @@ export async function optimizeChunks(
compact: true,
sourcemap,
chunkFileNames: (chunkInfo) =>
- `${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/, '')}-[hash].js`,
+ `${chunkInfo.name.replace(/-[a-zA-Z0-9_-]{8}$/, '')}-[hash].js`,
});
optimizedOutput = result.output;
}
diff --git a/tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts b/tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts
index 5eeef8888860..697f2234fbf7 100644
--- a/tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts
+++ b/tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts
@@ -137,36 +137,36 @@ const RESPONSE_EXPECTS: Record<
}
> = {
'/': {
- matches: [//],
+ matches: [//],
notMatches: [/ssg\-component/, /ssr/, /csr/, /cross-dep-/],
},
'/ssg': {
matches: [
- //,
- //,
+ //,
+ //,
],
notMatches: [/home/, /ssr/, /csr/, /ssg-one/, /ssg-two/, /cross-dep-/],
},
'/ssg/one': {
matches: [
- //,
- //,
+ //,
+ //,
],
notMatches: [/home/, /ssr/, /csr/, /ssg-two/, /ssg\-component/, /cross-dep-/],
},
'/ssg/two': {
matches: [
- //,
- //,
+ //,
+ //,
],
notMatches: [/home/, /ssr/, /csr/, /ssg-one/, /ssg\-component/, /cross-dep-/],
},
'/ssr': {
- matches: [//],
+ matches: [//],
notMatches: [/home/, /ssg\-component/, /csr/],
},
'/csr': {
- matches: [//],
+ matches: [//],
notMatches: [/home/, /ssg\-component/, /ssr/, /cross-dep-/],
},
};