Skip to content

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

Open
@finscn

Description

@finscn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions