Skip to content

Conversation

@DinoscapeProgramming
Copy link

@DinoscapeProgramming DinoscapeProgramming commented Jul 5, 2025

This PR fixes a "Maximum call stack size exceeded" error caused by infinite recursion in the _getNodeModules method within NodeModulesCollector.

Root Cause

The function did not account for cyclic dependencies in the hoisted dependency graph, causing unbounded recursion and stack overflows during the build process.

Fix

  • Added cycle detection using a Set<string> to track visited dependencies.
  • Prevents re-processing already-seen dependencies identified by name@version.

Impact

  • Resolves fatal crash during electron-builder packaging in large or monorepo projects.
  • Makes dependency resolution more stable and safe when hoisting is involved.

Originally reported in #8857.

…cies

Adds cycle detection using a Set<string> to avoid infinite recursion
when traversing hoisted dependency graphs. Fixes "Maximum call stack
size exceeded" error during electron-builder packaging.
@DinoscapeProgramming DinoscapeProgramming changed the title Fix stack overflow in electron-builder due to cyclic dependencies in _getNodeModules fix: stack overflow in electron-builder due to cyclic dependencies in _getNodeModules Jul 5, 2025
@DinoscapeProgramming
Copy link
Author

Sorry, didn't see #8864.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant