Skip to content

Commit ef7134c

Browse files
authored
fix: update getNames to handle circular dependencies (#3)
2 parents 839f0d1 + dc059a0 commit ef7134c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/extract-chunks.js

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

34-
function getNames (groups) {
34+
function getNames (groups, processed = new Set()) {
3535
const Entrypoint = require('webpack/lib/Entrypoint')
3636
const names = []
3737
for (const group of groups) {
@@ -40,8 +40,9 @@ function getNames (groups) {
4040
if (group.options.name) {
4141
names.push(group.options.name)
4242
}
43-
} else {
44-
names.push(...getNames(group.parentsIterable))
43+
} else if(!processed.has(group)) {
44+
processed.add(group)
45+
names.push(...getNames(group.parentsIterable, processed))
4546
}
4647
}
4748
return names

0 commit comments

Comments
 (0)