Skip to content

fix: revert to legacyMainResolve in JavaScript for asar compatibility - #41367

Merged
VerteDinde merged 1 commit into
mainfrom
legacy-module-resolve-js-revert
Feb 19, 2024
Merged

VerteDinde merged 1 commit into
mainfrom
legacy-module-resolve-js-revert

Conversation

@VerteDinde

Copy link
Copy Markdown
Member

Description of Change

Addresses #41241

Node's recent upstream conversion of legacyMainResolve from JavaScript to C++ (nodejs/node#48325) unfortunately doesn't take asar files into account, and may either incorrectly load or entirely fail to find and load the main file if an app is using a combination of ESM and asar, and one of the dependencies is using CommonJS. This PR reverts the native code change while we determine how to patch Node's new methods using asar.

Note: This revert was submitted in place of a potentially riskier fix for Electron's 29 stable release date. I targeted both main and 29-x-y in order to avoid main/branch drift, but happy to target this at 29-x-y only if we'd prefer that.

Checklist

Release Notes

Notes: Fixed an issue where some dependencies using CommonJS would cause ESM apps to fail to open.

@VerteDinde
VerteDinde requested a review from a team as a code owner February 18, 2024 07:09
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Feb 18, 2024
@VerteDinde VerteDinde added semver/patch backwards-compatible bug fixes target/29-x-y PR should also be added to the "29-x-y" branch. labels Feb 18, 2024
@codebytere

Copy link
Copy Markdown
Member

Supersedes #41348 - we're going to try a better long-term performant fix for 30 and fix it via revert for now.

@codebytere codebytere mentioned this pull request Feb 18, 2024
2 of 3 tasks
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Feb 19, 2024
@VerteDinde
VerteDinde merged commit 995f3dc into main Feb 19, 2024
@VerteDinde
VerteDinde deleted the legacy-module-resolve-js-revert branch February 19, 2024 07:21
@release-clerk

release-clerk Bot commented Feb 19, 2024

Copy link
Copy Markdown

Release Notes Persisted

Fixed an issue where some dependencies using CommonJS would cause ESM apps to fail to open.

@trop

trop Bot commented Feb 19, 2024

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "29-x-y", please check out #41371

@trop trop Bot added in-flight/29-x-y and removed target/29-x-y PR should also be added to the "29-x-y" branch. labels Feb 19, 2024
@trop trop Bot added merged/29-x-y PR was merged to the "29-x-y" branch. and removed in-flight/29-x-y labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/29-x-y PR was merged to the "29-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants