Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron-builder fails when list of node_modules files is too big to pass in a glob #8705

Open
abram opened this issue Nov 22, 2024 · 1 comment

Comments

@abram
Copy link

abram commented Nov 22, 2024

This recent change causes electron-builder to fail in my project:

const unpackGlob = unpackedPaths.length > 1 ? `{${unpackedPaths.join(",")}}` : unpackedPaths.pop()

It attempts to take a potentially large file list and put it into a glob pattern string. This causes an error due to exceeding a hard coded limit in minimatch:

pattern is too long
    at assertValidPattern (node_modules\minimatch\minimatch.js:280:11)
    at minimatch (node_modules\minimatch\minimatch.js:116:3)
    at isUnpackedDir (node_modules\@electron\asar\src\asar.ts:24:41)
    at handleFile (node_modules\@electron\asar\src\asar.ts:148:17)
    at next (node_modules\@electron\asar\src\asar.ts:185:5)
    at AsarPackager.executeElectronAsar (node_modules\app-builder-lib\src\asar\asarUtil.ts:77:5)
    at AsarPackager.pack (app-builder-lib\src\asar\asarUtil.ts:51:5)

You can see the limit code here:
https://github.com/isaacs/minimatch/blob/main/src/assert-valid-pattern.ts#L1

I'm not familiar with the asar module, but there must be a better way to pass a file list than using a giant glob.

@beyondkmp
Copy link
Collaborator

#8645 can fix this issue. It only add the node_modules/xxx into unpackedPaths intead of all sub directories in node_modules/xxx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants