Skip to content

Commit

Permalink
fix(entries): Don't add css entries twice
Browse files Browse the repository at this point in the history
  • Loading branch information
jantimon committed Mar 1, 2018
1 parent dc233b5 commit 0348d6b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {

This comment has been minimized.

Copy link
@sechel

sechel Jul 30, 2018

This is a problem as not all js assets end with .js, e.g., karma-webpack directly uses the chunk name: https://github.com/webpack-contrib/karma-webpack/blob/1ac16eaa7b11ee154a2127d4f03cbfd1a81533f6/src/karma-webpack.js#L65
See also #1013

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));
Expand Down

0 comments on commit 0348d6b

Please # to comment.