Can I cross-build electron-forge apps for all platforms?

Viewed 1071

I'm using electron-forge to build apps for Linux, macOS and Windows. Currently, I can build the macOS distributable natively from macOS, but I need two VMs to build for Linux and Windows.

From each platform VM, I just need to issue the make script:

npm run make

Is it possible to cross-build for all platforms from a single system? Do I need one specific platform to be able to build for the others as well?

What I want to accomplish is to be able to run a build script that will build distributable files for all supported platforms (namely Linux, macOS and Windows) from a single platform, without the need to manually run VMs.

2 Answers

If you're using macOS you can build for all 3 platforms. You can try electron-builder or electron-packager

Here's a simple command to generate distributables for all 3 platforms using electron-builder

electron-builder -mwl

If you are using npm run make it will generate platforms pecific distributables (installers, distribution packages, etc.) but by default it can only generate distributables for your current platform .

Checkout your package.json for more platform specific targets like dmg,zip for Macos

Related