Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 06c59a7

Browse files
committedMar 1, 2018
refactor(performance): Reduce the generated chunk information to speed up build time
1 parent 2c8637c commit 06c59a7

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed
 

‎index.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,24 @@ class HtmlWebpackPlugin {
8484

8585
compiler.plugin('emit', (compilation, callback) => {
8686
const applyPluginsAsyncWaterfall = self.applyPluginsAsyncWaterfall(compilation);
87-
// Get all chunks
88-
const allChunks = compilation.getStats().toJson().chunks;
87+
// Get chunks info as json
88+
// Note: we're excluding stuff that we don't need to improve toJson serialization speed.
89+
const chunkOnlyConfig = {
90+
assets: false,
91+
cached: false,
92+
children: false,
93+
chunks: true,
94+
chunkModules: false,
95+
chunkOrigins: false,
96+
errorDetails: false,
97+
hash: false,
98+
modules: false,
99+
reasons: false,
100+
source: false,
101+
timings: false,
102+
version: false
103+
};
104+
const allChunks = compilation.getStats().toJson(chunkOnlyConfig).chunks;
89105
// Filter chunks (options.chunks and options.excludeCHunks)
90106
let chunks = self.filterChunks(allChunks, self.options.chunks, self.options.excludeChunks);
91107
// Sort chunks

0 commit comments

Comments
 (0)
Please sign in to comment.