Skip to content

Commit 16f7767

Browse files
alan-agius4mgechev
authored andcommitted
fix(@angular-devkit/build-angular): remove .js files equivalent of css when using extract css
1 parent 221e821 commit 16f7767

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/angular_devkit/build_angular/src/webpack/plugins/suppress-entry-chunks-webpack-plugin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export class SuppressExtractedTextChunksWebpackPlugin {
1414
apply(compiler: import('webpack').Compiler): void {
1515
compiler.hooks.compilation.tap('SuppressExtractedTextChunks', (compilation) => {
1616
compilation.hooks.chunkAsset.tap('SuppressExtractedTextChunks', (chunk, filename) => {
17+
if (compiler.options?.devServer?.hot) {
18+
// don't remove `.js` files for `.css` when we are using HMR these contain HMR accept codes.
19+
return;
20+
}
21+
1722
// Remove only JavaScript assets
1823
if (!filename.endsWith('.js')) {
1924
return;
@@ -58,7 +63,10 @@ export class SuppressExtractedTextChunksWebpackPlugin {
5863
return (
5964
name === 'CssDependency' ||
6065
name === 'SingleEntryDependency' ||
61-
name === 'MultiEntryDependency'
66+
name === 'MultiEntryDependency' ||
67+
name === 'HarmonyCompatibilityDependency' ||
68+
name === 'HarmonyExportHeaderDependency' ||
69+
name === 'HarmonyInitDependency'
6270
);
6371
});
6472

0 commit comments

Comments
 (0)