Skip to content

Commit 020b714

Browse files
rodneyrehmjantimon
authored andcommittedMar 6, 2018
fix(entries): do not ignore JS if there is also CSS
broken by commit 0348d6b
1 parent 5711f16 commit 020b714

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,13 @@ class HtmlWebpackPlugin {
453453
}
454454

455455
// Webpack outputs an array for each chunk when using sourcemaps
456-
// But we need only the initial entry file in case it is a js file
457-
const entry = chunkFiles[0];
458-
if (/.js($|\?)/.test(entry)) {
456+
// or when one chunk hosts js and css simultaneously
457+
const js = chunkFiles.find(chunkFile => /.js($|\?)/.test(chunkFile));
458+
if (js) {
459459
assets.chunks[chunkName].size = chunk.size;
460-
assets.chunks[chunkName].entry = entry;
460+
assets.chunks[chunkName].entry = js;
461461
assets.chunks[chunkName].hash = chunk.hash;
462-
assets.js.push(entry);
462+
assets.js.push(js);
463463
}
464464

465465
// Gather all css files

0 commit comments

Comments
 (0)
Please sign in to comment.