Pkg: How to make a ".exe" for both 32-bits and 64bits?

Created on 4 Apr 2018  路  4Comments  路  Source: vercel/pkg

Hello,
Anyone could help me on how to create a single Windows binary for a Node.js application that will both work on 32-bts System and on x64 one too please?
Thank you in advance.

Most helpful comment

A 32-bit binary will run on either Windows 32-bit or 64-bit. This is the simplest solution. Specify x86 for the arch: https://github.com/zeit/pkg#targets

All 4 comments

A 32-bit binary will run on either Windows 32-bit or 64-bit. This is the simplest solution. Specify x86 for the arch: https://github.com/zeit/pkg#targets

Thank you.
The fact is that even if a 32-bit app will run on a x64 platform, it is not optimized to do so :(. Is there any tool available in pkg to create an installer that will bundle both 2 versions of the app (x86 and x64) that will install the right version?

I don't believe that pkg has any tools to create any installer itself. You can create both binaries using pkg and then use an installer creator, like NSIS, to create an installer that can choose which arch to install at runtime.

Other hacks to achieve a fat binary would likely be outside pkg's intended use.

In my package.json I have kept following configuration and it created build for both 32 and 64 bit Windows machine

"pkg": {
"assets": [
"xxx//",
"xxx/
/"
],
"scripts": "xxx/*/.js",
"targets": [
"node8",
"x86"
]
},

and run code through pkg .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterjwest picture peterjwest  路  3Comments

gillez picture gillez  路  4Comments

adrukh picture adrukh  路  4Comments

Araknos picture Araknos  路  4Comments

jflayhart picture jflayhart  路  4Comments