From 020b7148b4869f6fedf6873c1b65c46596e59c89 Mon Sep 17 00:00:00 2001 From: Rodney Rehm Date: Mon, 5 Mar 2018 20:54:04 +0100 Subject: [PATCH] fix(entries): do not ignore JS if there is also CSS broken by commit 0348d6b --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 0518b121..b2e9013d 100644 --- a/index.js +++ b/index.js @@ -453,13 +453,13 @@ class HtmlWebpackPlugin { } // Webpack outputs an array for each chunk when using sourcemaps - // But we need only the initial entry file in case it is a js file - const entry = chunkFiles[0]; - if (/.js($|\?)/.test(entry)) { + // or when one chunk hosts js and css simultaneously + const js = chunkFiles.find(chunkFile => /.js($|\?)/.test(chunkFile)); + if (js) { assets.chunks[chunkName].size = chunk.size; - assets.chunks[chunkName].entry = entry; + assets.chunks[chunkName].entry = js; assets.chunks[chunkName].hash = chunk.hash; - assets.js.push(entry); + assets.js.push(js); } // Gather all css files