`packagerConfig.asar.unpackDirs` in forge.config.js doesn't support Array
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 641
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 30
Description
### Pre-flight checklist
- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] 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.
```js
/**
* 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_
Contributor guide
Assessment
This issue has not been assessed yet.