Skip to content

Commit

Permalink
reuseExistingChunk is able to reuse an entry chunk when it's the only…
Browse files Browse the repository at this point in the history
… selected chunk
  • Loading branch information
sokra committed Jan 19, 2021
1 parent 8918ab1 commit 2b3489d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/optimize/SplitChunksPlugin.js
Expand Up @@ -1298,7 +1298,10 @@ module.exports = class SplitChunksPlugin {
) {
continue;
}
if (chunkGraph.getNumberOfEntryModules(chunk) > 0) {
if (
item.chunks.size > 1 &&
chunkGraph.getNumberOfEntryModules(chunk) > 0
) {
continue;
}
for (const module of item.modules) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,5 @@
module.exports = {
findBundle: function (i, options) {
return ["runtime~vendor.js", "vendor.js"];
}
};
@@ -0,0 +1,19 @@
/** @type {import("../../../../").Configuration} */
module.exports = {
entry: {
vendor: "vendor"
},
output: {
filename: "[name].js"
},
target: "web",
optimization: {
chunkIds: "named",
runtimeChunk: true,
splitChunks: {
chunks: "all",
minSize: 10,
enforceSizeThreshold: 20
}
}
};

0 comments on commit 2b3489d

Please sign in to comment.