Skip to content

Commit efa8b52

Browse files
committed
use children option instead of selectedChunks === false
1 parent 5838f56 commit efa8b52

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎lib/optimize/CommonsChunkPlugin.js‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ The available options are:
3030
this.filenameTemplate = normalizedOptions.filenameTemplate;
3131
this.minChunks = normalizedOptions.minChunks;
3232
this.selectedChunks = normalizedOptions.selectedChunks;
33+
this.children = normalizedOptions.children;
3334
this.async = normalizedOptions.async;
3435
this.minSize = normalizedOptions.minSize;
3536
this.ident = normalizedOptions.ident;
@@ -93,13 +94,13 @@ The available options are:
9394
* - If chunk has the name as specified in the chunkNames it is put in the list
9495
* - If no chunk with the name as given in chunkNames exists a new chunk is created and added to the list
9596
*/
96-
const commonChunks = this.getCommonChunks(chunks, compilation, this.chunkNames, this.selectedChunks, this.async);
97+
const commonChunks = this.getCommonChunks(chunks, compilation, this.chunkNames, this.children, this.async);
9798

9899
// iterate over all our new chunks
99100
commonChunks.forEach((commonChunk, idx) => {
100101
// get chunks that are actually used
101102
// TODO: clarify what that means
102-
const usedChunks = this.getUsedChunks(compilation, chunks, commonChunk, commonChunks, idx, this.selectedChunks, this.async);
103+
const usedChunks = this.getUsedChunks(compilation, chunks, commonChunk, commonChunks, idx, this.selectedChunks, this.async, this.children);
103104

104105
// bail as this is an erronous state
105106
if(!usedChunks) {
@@ -159,8 +160,8 @@ The available options are:
159160
});
160161
}
161162

162-
getCommonChunks(allChunks, compilation, chunkNames, selectedChunks, asyncOption) {
163-
const asyncOrNoSelectedChunk = selectedChunks === false || asyncOption;
163+
getCommonChunks(allChunks, compilation, chunkNames, children, asyncOption) {
164+
const asyncOrNoSelectedChunk = children || asyncOption;
164165

165166
// we have specified chunk names
166167
if(chunkNames) {
@@ -190,8 +191,8 @@ The available options are:
190191
throw new Error("Invalid chunkNames argument");
191192
}
192193

193-
getUsedChunks(compilation, allChunks, commonChunk, commonChunks, currentIndex, selectedChunks, asyncOption) {
194-
const asyncOrNoSelectedChunk = selectedChunks === false || asyncOption;
194+
getUsedChunks(compilation, allChunks, commonChunk, commonChunks, currentIndex, selectedChunks, asyncOption, children) {
195+
const asyncOrNoSelectedChunk = children || asyncOption;
195196

196197
if(Array.isArray(selectedChunks)) {
197198
return allChunks.filter(chunk => {

0 commit comments

Comments
 (0)