universal
universal copied to clipboard
fix: support esm entrypoints for asar shim
Fixes #90
In cases where two ASAR archives or app folders are created, we create a new index.js shim that points to the correct entrypoint depending on the host system's architecture.
This index.js shim was originally written in CommonJS, making it incompatible with Electron apps using ESM entrypoints, which are available starting in Electron 28.
This PR does a few things:
- Adds an ESM version of the
entry-asar/index.jsshim. - Detects if the main entrypoint is ESM through
type: moduleormain:*.mjsin package.json, then copies over the ESM or CJS shim accordingly. - Does a bit of
tsconfig.jsonrefactoring to supportentry-asarhaving different compilation targets.