Skip to content

Commit 59e67d8

Browse files
committed
optimize array operation
1 parent 2b518a6 commit 59e67d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/ChunkGraph.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,11 @@ class ChunkGraph {
198198
findGraphRoots(set, module => {
199199
return moduleGraph
200200
.getOutgoingConnections(module)
201-
.map(connection => connection.module)
202-
.filter(Boolean);
201+
.reduce((arr, connection) => {
202+
const module = connection.module;
203+
if (module) arr.push(module);
204+
return arr;
205+
}, []);
203206
})
204207
).sort(compareModulesByIdentifier);
205208
}

0 commit comments

Comments
 (0)