From 0348d6b48c7313806bc3350ac6516f1ad1bff645 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Thu, 1 Mar 2018 06:57:39 +0100 Subject: [PATCH] fix(entries): Don't add css entries twice --- index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index be4ab2ef..0518b121 100644 --- a/index.js +++ b/index.js @@ -453,12 +453,14 @@ class HtmlWebpackPlugin { } // Webpack outputs an array for each chunk when using sourcemaps - // But we need only the entry file + // But we need only the initial entry file in case it is a js file const entry = chunkFiles[0]; - assets.chunks[chunkName].size = chunk.size; - assets.chunks[chunkName].entry = entry; - assets.chunks[chunkName].hash = chunk.hash; - assets.js.push(entry); + if (/.js($|\?)/.test(entry)) { + assets.chunks[chunkName].size = chunk.size; + assets.chunks[chunkName].entry = entry; + assets.chunks[chunkName].hash = chunk.hash; + assets.js.push(entry); + } // Gather all css files const css = chunkFiles.filter(chunkFile => /.css($|\?)/.test(chunkFile));