diff --git a/lib/plugins/src/_internal/dependency-graph.ts b/lib/plugins/src/_internal/dependency-graph.ts index cefaef1..64dcd00 100644 --- a/lib/plugins/src/_internal/dependency-graph.ts +++ b/lib/plugins/src/_internal/dependency-graph.ts @@ -33,15 +33,18 @@ export function computePendingNodes() { pRootNodes.clear() while (stack.length) { - const plugin = stack.pop()! - if (visited.has(plugin)) continue + const plugin = stack.shift()! - if (plugin.manifest.dependencies?.length) - for (const dep of getPluginDependencies(plugin)) stack.push(dep) - else { + if (visited.has(plugin)) { pListOrdered.push(plugin) - visited.add(plugin) + continue } + + if (plugin.manifest.dependencies?.length) { + for (const dep of getPluginDependencies(plugin)) stack.push(dep) + stack.push(plugin) + visited.add(plugin) + } else pListOrdered.push(plugin) } }