electron-builder: Macro "arch" does not work in artifactName for NSIS
-
Version: 21.2.0
-
Target: Windows (NSIS)
I am using the command electron-builder --ia32 on Windows 10 to create a 32 bit installer for my app. The name of the produced .exe file ends up as Blockbench_3.0.0.exe, where the arch part is stripped from the name.
This is the defined artifactName: "${productName}_${arch}_${version}.${ext}"
Here is the relevant build section in my package.json: https://github.com/JannisX11/blockbench/blob/master/package.json#L62-L65
Note that this is an installer specifically for 32-bit Windows. It is not a combined installer. Using a combined installer would double the file size and the download time of the installer.
Related: #3574
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 21 (2 by maintainers)
I have the same problem!
${arch} does not take effect in artifactName.
e.g conf:
artifactName: "${productName}-${version}-${os}-${arch}.${ext}"output: appname-0.0.1-win.exe@gknapp it seems they’re all combined. It’s basically assuming that you always want a universal electron installer
I found these differences. Both build a specific arch during the normal build loop. AppxTarget: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/AppxTarget.ts#L37-L45 MsiTarget: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/MsiTarget.ts#L43-L51
NsisTarget, on the other hand, queues all architectures and then packages all archs in a single
finishBuildtask https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L64-L66This is the specific line causing the macro to be ignored: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L130
In order to not break backward compatibility, it seems we’d have to add additional packaging steps for bundling both arch-specific builds and it’s current universal installer. It’s a shame that nsis can’t use
Arch.universalflag instead. Any other suggestions?–
Btw, if anyone wants to take a stab at this, here is how to set up a local dev env: https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#to-setup-a-local-dev-environment