Skip to content

Commit 3954783

Browse files
committed
Implemented Aaron's suggestions to getNames
1 parent 5a9973b commit 3954783

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib/extract-chunks.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ function getChunkEntryNames (chunk) {
3131
}
3232
}
3333

34-
const processedGroups = new Set();
35-
function getNames (groups) {
34+
function getNames (groups, processed = new Set()) {
3635
const Entrypoint = require('webpack/lib/Entrypoint')
3736
const names = []
3837
for (const group of groups) {
@@ -41,13 +40,12 @@ function getNames (groups) {
4140
if (group.options.name) {
4241
names.push(group.options.name)
4342
}
44-
}
45-
else if (!processedGroups.has(group)) {
46-
processedGroups.add(group);
47-
names.push(...getNames(group.parentsIterable));
43+
} else if(!processed.has(group)) {
44+
processed.add(group);
45+
names.push(...getNames(group.parentsIterable, processed))
4846
}
4947
}
50-
return names
48+
return names;
5149
}
5250

5351
function extractChunks ({ compilation, optionsInclude }) {

0 commit comments

Comments
 (0)