universal icon indicating copy to clipboard operation
universal copied to clipboard

fix: support esm entrypoints for asar shim

Open erickzhao opened this issue 1 year ago • 0 comments

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.js shim.
  • Detects if the main entrypoint is ESM through type: module or main:*.mjs in package.json, then copies over the ESM or CJS shim accordingly.
  • Does a bit of tsconfig.json refactoring to support entry-asar having different compilation targets.

erickzhao avatar Jun 13 '24 03:06 erickzhao