From 06c59a7cc150dc5613a724e8d7ed62b86daa0b18 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Thu, 1 Mar 2018 07:37:04 +0100 Subject: [PATCH] refactor(performance): Reduce the generated chunk information to speed up build time --- index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a82429db..be4ab2ef 100644 --- a/index.js +++ b/index.js @@ -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