-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
asarUnpack not honored with electron-builder 25.1.8, brings many unneeded files into app.asar.unpacked (source files, readmes, package.json, etc.) #8640
Comments
Can you try testing with |
Tried with |
I tested your project locally and it looks like that regressed in 24.0.0-alpha.1. Can you confirm from your side? Looks like that came in this diff: v23.6.0...v24.0.0-alpha.1 |
Actually, it works fine in |
In my tests, the issue is introduced in |
I suspect this change: https://github.com/electron-userland/electron-builder/pull/8398/files |
Hmmmm, I think it looks like this change caused the test snapshots to expand coverage to include parent directories of .node modules, which is what you're experiencing. #8392 Can you test with this
|
The patch above on top of 26.0.0-alpha.4 fixes the issue. |
@mmaietta All npm C++ native modules generate a file ending in .node, which is an executable file. Currently, it is default practice to place these inside app.asar, the user currently needs to manually specify asarUnpack. This MR (#8392) aims to handle .node files automatically like exe and dll files, so users won't need to manually specify them in asarUnpack. |
Hmmm, that's a fair point, but I guess the previous MR also added all the parent directories during the unpack step. We need only the |
Yes, you are right. I have a question: Should we apply the same treatment to exe and dll files as well, only extracting these specific files without unpacking other files in their parent folders? |
I don't think so in this case as That being said, I do agree that the |
From this function's perspective, it appears to include executable files for multiple operating systems. dylib are macOS-specific and so is linux-specific. I mean that all these executable files should be handled in the same way - only the executable files themselves should be placed in asarUnpack, while other files in their parent directories should not be included unless specifically specified by the user. |
I agree with this, but I want to know why it was originally coded this way in the first place. If we can get |
@ivanggq , out of curiosity, what is the core issue here? The "unneeded" files were always being included in your The caveat of a revert is that |
I was frankly not aware that these files are part of the To answer your question first - my motivation for filing this ticket is that the source files of native dependencies we use are easily visible in the Which leads me to the additional questions:
|
You can add them to the
From what I understand, they're not actually duplicated, they're symlinks within the asar. Upon extraction of the asar, |
OK, I will try that for my internal project and report back. (May need a day or two for this). Thanks for the quick replies and looking into this. |
This works for our project, so I think we can close this ticket now. Thanks. |
Recent changes in electron-builder (not sure when exactly this started) bring all kind of unnecessary files into the
app.asar.unpacked
folder (where native dependencies are). We have anasarUnpack
rulenode_modules/**/*.node
.This works fine with electron-builder 23.6.0, but not with recent electron-builder versions.
The unnecessary files in
app.asar.unpacked
could be (but not limited to):Example:
Repro code: source-files-unpacked.zip
To repro:
npm install
npm run package
dist\win-unpacked\resources\app.asar.unpacked\node_modules\native-reg
folder - it has a bunch of unneeded files that are not part ofasarUnpack
electron-builder
version in package.json to23.6.0
, npm install and repackage - only the.node
files are packagedDepending on the native dependency, this issue could bring C++ source files, Jenkinsfiles, etc.
I did notice in
builder-debug.yml
that .cc extensions are excluded byfirstOrDefaultFilePatterns
and this is likely why .cc files are not there (while .h and .cpp are for example), but to my understanding, theasarUnpack
rule should be respected here. At least it seems to be respected more inelectron-builder
version23.6.0
.The text was updated successfully, but these errors were encountered: