Repository navigation
fix: ESM legacyMainResolve with asar - #41348
codebytere wants to merge 3 commits into
Conversation
|
THANK YOU! |
78b7163 to
27cda15
Compare
e206abe to
2c39db3
Compare
MarshallOfSound
left a comment
There was a problem hiding this comment.
Was chatting with Keeley about this, we should be putting ASAR into the native method, not duplicating the native method into JS like this, it's quite complex and drift will be an issue
|
|
||
| // Copy out the original package.json into a temp directory so | ||
| // it can be read. | ||
| const tempPackageJSON = archive.copyFileOut(filePath); |
There was a problem hiding this comment.
Was chatting with keeley about this, we shouldn't be copying the file out to a temp folder just to read it. We should do what we do below and read from the asar fd at the offset
There was a problem hiding this comment.
We should do what we do below and read from the asar fs at the offset
say a bit more? the impl here is picky about files existing at certain paths so i'm not sure we can drop in that approach quite the same 🤔
There was a problem hiding this comment.
Copying out from DMs:
we should patch the native method used to determine if a file exists / read the package json to use asar::Archive
- Extract the Archive class to a separate source_set
- Make lib_electron depend on that source_set
- Make electron_node depend on that source_set
- Patch the native method to support ASAR
like, copying a file out of the ASAR for every single module load is kinda crazy and gonna be way too slow
We need to just make node itself aware of ASAR instead of patching in a slow drifting JS impl
|
Superseded by #41367 |
Description of Change
Fixes #41241
Refs nodejs/node#48325 via 9c94fd7afb4706c2d2228a455f0874a0370cfe1d- this issue seems to have been caused by a switch to native legacyMainResolve which does not take asar into account. Override it to fix this.
Before
After
Checklist
npm testpassesRelease Notes
Notes: Fixed an issue where some dependencies would cause some ESM apps to fail to open.