Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support esm entrypoints for asar shim #101

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

erickzhao
Copy link
Member

@erickzhao erickzhao commented Jun 13, 2024

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 erickzhao requested a review from a team as a code owner June 13, 2024 03:52
@erickzhao erickzhao marked this pull request as draft June 13, 2024 03:52
@erickzhao erickzhao marked this pull request as ready for review June 13, 2024 05:32
package.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App entrypoint fails to load for ESM app if arm64 and x64 apps don't match
2 participants