Packaging JavaScript for the Desktop

@makerhacks · 2025-10-16 09:57 · programming

Need a desktop version of your JavaScript application or game? Which tool should you use?

I've been building a markdown text editor for my own use, and I wanted it to be multi-platform so that I could share it with other people.

Yes, I wrote this article using my app!

The problem I have is it works but it is a lot more bloated than a text editor should be. It's compiled using Electron which bundles a whole web browser right into the app. That's a memory hog and makes the distributable a much bigger download than people would expect.

Also I find Electron architecture more cumbersome than it needs to be for simple tools and utilities, so I find myself turning to C/C++ or Python and command line interfaces out of comfort zone. This isn't a problem short term, but career wise and commercially I need to have more in my resume toolbox.

Here's what I learned about the JavaScript packaging options today in 2025, and what I will be looking at using in future. Let me know if there are options I have not considered!

1. Electron https://www.electronjs.org/

Electron allows developers to build cross-platform desktop apps using essentially a Node web dev setup, but on a local machine (HTML, CSS, and JavaScript). It does this by packaging a Chromium browser right in to the executable, but on the plus side it runs exactly as it you would expect.

Pros:

  • Uses familiar web development tools.

  • Access to vast Node.js packages via npm.

  • Consistent experience across platforms.

  • Popular choice (VS Code, Slack, Discord, Notion, Dropbox)

Cons:

  • Creates huge app sizes because each app includes its own Chromium.

  • Can be resource-heavy, especially for simple apps or games.

  • Communication via Inter-Process Communication (IPC).

  • Build tools for multiple OSs (Electron Forge or Electron Builder).

2. Tauri https://v2.tauri.app/

Tauri uses the native web view of each OS instead of bundling its own browser engine. This results in smaller app sizes and easier access to system file operations.

Pros:

  • Smaller size since it uses Edge on Windows, WebKit on macOS and Linux.

  • Easier to work with local file system/OS via a simple JavaScript API.

  • Plenty of options for integrating native SDKs.

Cons:

  • Requires writing Rust for more lower-level operations.

  • Web view engines differences, which can cause rendering problems.

  • Need to run different OS environments for each build.

3, 4. Neutralino.js https://neutralino.js.org/ and Wails https://wails.io/

Both Neutralino and Wails are similar to Tori, aimed at quick, simple desktop apps using Web tech without the heft of Electron.

  • Neutralino.js: JavaScript API for simple file operations, and backend can be in any language via WebSockets.

  • Wails: Uses Go for native code.

Pros:

  • Smaller app sizes.

  • Easier API for common tasks like file access.

  • Good for simple apps not requiring complex SDK integrations.

Cons:

  • Limited in their ability to fully interface with APIs/SDKs.

  • Build on each OS to generate correct binaries.

5. NW.js https://nwjs.io/

So far it seems the winner is NW.js. It produces small, high performing binaries, for the major desktop OSes. Over 5,700 games on Steam are built with NW.js (e.g., games built using RPG Maker and Construct).

Support for the major desktop operating systems

Benefits:

  • Ease of coding: No forced separation between frontend and backend code or need for anything but JavaScript.

  • Simple OS operations: Writing and reading save files with straightforward code.

  • Cross-platform: Creating executables for Windows, Mac, and Linux is straightforward using pre-built binaries and minimal setup.

  • Smooth workflow: Minimal modifications needed to package web app for desktop. It allows quick iterations, hot reloading during development, and simple build automation.

To use NW.js you simply include your source code in a designated folder (called package.nw) alongside a pre-compiled NW.js binary for each target platform. Running the binary loads your code as a native desktop app, similar to launching a regular executable.

  1. Download the NW.js binaries for your platforms.

  2. Put your code inside a folder named package.nw.

  3. Merge the folder with the NW.js binary.

  4. Rename the output as your app's name

  5. Use a tool to customise icons if desired.

This process should make distribution simple, allowing you to generate and update standalone executables quickly.

What's Next?

If you're interested in wrapping your JavaScript for desktop give NW.js a try. I think I will put it to the test with a simple project such as a small game or utility before embarking on a whole app.

#programming #javascript #techology #gamedev
Payout: 0.000 HBD
Votes: 518
More interactions (upvote, reblog, reply) coming soon.