How to compile an Electron application to an .exe with JavaScript?

Sometimes, we want to compile an Electron application to an .exe with JavaScript.

In this article, we’ll look at how to compile an Electron application to an .exe with JavaScript.

How to compile an Electron application to an .exe with JavaScript?

To compile an Electron application to an .exe with JavaScript, we use Electron Packager.

To install it, we run

npm install electron-packager --save-dev

in our project folder.

We can also install it globally with

npm install electron-packager -g

Then we compile the project into an .exe with

electron-packager <sourcedir> <appname> --platform=win32 --arch=x86_64

Conclusion

To compile an Electron application to an .exe with JavaScript, we use Electron Packager.