electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.71k stars 1.74k forks source link

Additional unversial exe package is generated #8597

Open qishibo opened 1 month ago

qishibo commented 1 month ago

if I build arm64 and x64 nsis target, and my build field like bellow

"win": {
  "target": [
    {"target": "nsis", "arch": ["x64", "arm64"]}
  ]
},
"nsis": {
  "artifactName": "${productName}-Setup-${version}-${arch}.${ext}",
}

after building I got 3 exes instead of 2(arm64 and x64), it seems that an universial package is generated, and its size is about 2 times bigger than arm64 and x64. I am quite confused about this, can I remove the universal version??

image
qishibo commented 1 month ago

tried again in local machine, if I don't want this universal version, how can I config to reduct this

image

mmaietta commented 1 month ago

I took a solid look at the code and am unable to determine the reason as to why a universal package needs to be generated. The logic is quite complex though and AFAICT I don't think it's possible to remove the universal package from being generated. AFAICT, the logic exists here: https://github.com/electron-userland/electron-builder/blob/f941f18a003a3762949a36e4a06e98e1014d3ed1/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L237-L252

mmaietta commented 1 month ago

Looks like there's been a request to disable the universal package before as well: https://github.com/electron-userland/electron-builder/issues/8298

mmaietta commented 1 month ago

X-posting

Would anyone be willing to test out this patch-package?

Patch found here: https://github.com/electron-userland/electron-builder/issues/8298#issuecomment-2432884953