electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.35k stars 497 forks source link

Default `ignore` can be accidentally overridden in `packagerConfig` #3310

Open 12joan opened 11 months ago

12joan commented 11 months ago

Pre-flight checklist

Electron Forge version

6.0.5

Electron version

v22.2.0

Operating system

macOS 13.4.1

Last known working Electron Forge version

No response

Expected behavior

Specifying an ignore option in packagerConfig should not replace any default options (unless the ignore option is a function, as per electron-packager's standard behaviour).

Actual behavior

If ignore is not specified in packagerConfig, then it defaults to [/^\/out\//g]. Setting ignore to any other value silently overrides this default.

As a consequence of this, the packager fails to remove the out directory.

For me, this results in the following crash:

An unhandled rejection has occurred inside Forge:
Error: Detected file "Contents/Resources/app/out/<MY APP>-darwin-arm64/<MY APP>.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework" that's the same in both x64 and arm64 builds and not covered by the x64ArchFiles rule: "undefined"
at exports.makeUniversalApp (<APP ROOT>/node_modules/@electron/universal/dist/cjs/index.js:101:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async packageUniversalMac (<APP ROOT>/node_modules/electron-packager/src/universal.js:56:3)
    at async Promise.all (index 0)
    at async packager (<APP ROOT>/node_modules/electron-packager/src/index.js:204:20)

Steps to reproduce

I'm testing this by placing a console.log(opts.ignore) statement at the top of the userPathFilter function in node_modules/electron-packager/src/copy-filter.js.

Additional information

No response

michi88 commented 10 months ago

Indeed ran into this today as well, thanks for the report!