Skip to content

Commit

Permalink
refactor(performance): Reduce the generated chunk information to spee…
Browse files Browse the repository at this point in the history
…d up build time
  • Loading branch information
jantimon committed Mar 1, 2018
1 parent 2c8637c commit 06c59a7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,24 @@ class HtmlWebpackPlugin {

compiler.plugin('emit', (compilation, callback) => {
const applyPluginsAsyncWaterfall = self.applyPluginsAsyncWaterfall(compilation);
// Get all chunks
const allChunks = compilation.getStats().toJson().chunks;
// Get chunks info as json
// Note: we're excluding stuff that we don't need to improve toJson serialization speed.
const chunkOnlyConfig = {
assets: false,
cached: false,
children: false,
chunks: true,
chunkModules: false,
chunkOrigins: false,
errorDetails: false,
hash: false,
modules: false,
reasons: false,
source: false,
timings: false,
version: false
};
const allChunks = compilation.getStats().toJson(chunkOnlyConfig).chunks;
// Filter chunks (options.chunks and options.excludeCHunks)
let chunks = self.filterChunks(allChunks, self.options.chunks, self.options.excludeChunks);
// Sort chunks
Expand Down

0 comments on commit 06c59a7

Please sign in to comment.