Skip to content

Commit b45588b

Browse files
committed
CommonsChunkPlugin in async mode doesn't select initial chunks
fixes webpack#4795
1 parent c91ba49 commit b45588b

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

lib/optimize/CommonsChunkPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ You can however specify the name of the async chunk by passing the desired strin
190190

191191
// we dont have named chunks specified, so we just take all of them
192192
if(asyncOrNoSelectedChunk) {
193-
return allChunks;
193+
return allChunks.filter(chunk => !chunk.isInitial());
194194
}
195195

196196
/**
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require("should");
2+
3+
it("should run successful", function() {
4+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
findBundle: function(i, options) {
3+
return [
4+
"./manifest.js",
5+
"./main.js"
6+
];
7+
}
8+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var CommonsChunkPlugin = require("../../../../lib/optimize/CommonsChunkPlugin");
2+
module.exports = {
3+
entry: {
4+
main: "./index",
5+
second: "./index"
6+
},
7+
target: "web",
8+
output: {
9+
filename: "[name].js"
10+
},
11+
plugins: [
12+
new CommonsChunkPlugin({
13+
minChunks: Infinity,
14+
name: "manifest"
15+
}),
16+
new CommonsChunkPlugin({
17+
async: "async",
18+
minChunks: 2
19+
})
20+
]
21+
};

0 commit comments

Comments
 (0)