Skip to content

packagerConfig.asar.unpackDirs in forge.config.js doesn't support Array #3882

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

Open
3 tasks done
finscn opened this issue Mar 13, 2025 · 0 comments
Open
3 tasks done

Comments

@finscn
Copy link

finscn commented Mar 13, 2025

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Forge version

7.7.0

Electron version

35.0.0

Operating system

macOS 15

Last known working Forge version

No response

Expected behavior

the doc says unpackDirs could use Array.

/**
 * Whether a directory should be excluded from packing due to the `--unpack-dir" option.
 *
 * @param dirPath - directory path to check
 * @param pattern - literal prefix [for backward compatibility] or glob pattern
 * @param unpackDirs - Array of directory paths previously marked as unpacked
 */

But ,When use Array , I hope electron-forge could unpack all dirs that match every pattern in the array.

Actual behavior

When use Array , there is an error :

An unhandled rejection has occurred inside Forge:
TypeError: invalid pattern
at assertValidPattern (/Users/rocky/DEV/air-electron/node_modules/minimatch/minimatch.js:275:11)
    at minimatch (/Users/rocky/DEV/air-electron/node_modules/minimatch/minimatch.js:116:3)
    at isUnpackedDir (/Users/rocky/DEV/air-electron/node_modules/@electron/asar/lib/asar.js:54:64)
    at shouldUnpackPath (/Users/rocky/DEV/air-electron/node_modules/@electron/asar/lib/asar.js:150:32)

I read the source code of asar.js & minimatch.js .
When use Array , isUnpackedDir() will pass the array to minimatch, but the minimatch.default() doesn't support Array.

I think you should for-each the array in isUnpackedDir() , and pass each element of array to minimatch one by one .

Steps to reproduce

set a pattern-array to packagerConfig.asar.unpackDirs in forge.config.js

Additional information

No response

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

1 participant