fix: revert to legacyMainResolve in JavaScript for asar compatibility #41367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
npm test
passesRelease Notes
Notes: Fixed an issue where some dependencies using CommonJS would cause ESM apps to fail to open.