Skip to content

Commit

Permalink
CommonsChunkPlugin in async mode doesn't select initial chunks
Browse files Browse the repository at this point in the history
fixes #4795
  • Loading branch information
sokra committed May 4, 2017
1 parent c91ba49 commit b45588b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/optimize/CommonsChunkPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ You can however specify the name of the async chunk by passing the desired strin

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

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require("should");

it("should run successful", function() {
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
findBundle: function(i, options) {
return [
"./manifest.js",
"./main.js"
];
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var CommonsChunkPlugin = require("../../../../lib/optimize/CommonsChunkPlugin");
module.exports = {
entry: {
main: "./index",
second: "./index"
},
target: "web",
output: {
filename: "[name].js"
},
plugins: [
new CommonsChunkPlugin({
minChunks: Infinity,
name: "manifest"
}),
new CommonsChunkPlugin({
async: "async",
minChunks: 2
})
]
};

0 comments on commit b45588b

Please sign in to comment.