electron-builder: 26.0.6 node-module-collector RangeError: Maximum call stack size exceeded

I just attempted to update from electron-builder 25.1.8 to 26.0.6 and received the RangeError: Maximum call stack size exceeded error from the node-module-collector (full error below). The irony of that is that we don’t even need electron-builder to create a list of node_modules to include, as we explicitly exclude them from being packaged with !node_modules/**/* in the files array, as we bundle the JavaScript code before calling electron-builder.

So this issue is a bug report but also an ask for electron-builder to check the files array before collecting the node_modules, so that it can avoid doing work that isn’t necessary. If checking the files array isn’t possible a boolean config option to skip the node_modules collection would also work.

RangeError: Maximum call stack size exceeded
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:54:21)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)
    at flatten (...\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:69:9)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

I have been experiencing the same issue in version 26.0.12, using electron 34.4.0

Can you provide a minimal reproducible demo? Or share your dependencies?

Hi! After some debugging I was able to identify that the issue was happening when the version 3.5.4 of react-native-audio-recorder-player was used. Updating it to latest version solved the issue

I have been experiencing the same issue in version 26.0.12, using electron 34.4.0

@vassbo Thanks. I can reproduce it by unit test now.

test.ifAll("yarn max stack", () =>
  assertPack(
    "test-app-hoisted",
    {
      targets: Platform.WINDOWS.createTarget(DIR_TARGET, Arch.x64),
    },
    {
      isInstallDepsBefore: true,
      projectDirCreated: async (projectDir, tmpDir) => {
        await outputFile(path.join(projectDir, "yarn.lock"), "")
        await modifyPackageJson(projectDir, data => {
          data.dependencies = {
            "npm-run-all": "^4.1.5",
          }
        })
      },
      packed: context => verifyAsarFileTree(context.getResources(Platform.WINDOWS)),
    }
  )
)