DEV Community

Tony Pujals for Google Cloud

Posted on • Edited on • Originally published at codesnip.sh

4

Building Standalone Executables With Node.js

Node.js has experimental support for building a single executable application, or SEA, which is what the team calls a standalone executable that can be distributed to supported platforms.

The way the feature works is that a single blob is injected into the node binary for a supported platform. This single blob can be a JavaScript file, including multi-file JavaScript source that has been bundled with a tool like Webpack. If the blob is present, then the node binary will execute the script in the blob.

The recipe for building a SEA is spelled out in the docs.

Unfortunately, the developer experience is not yet on par with Deno or Bun.js. I wrote a build script to streamline building a SEA for Linux and Darwin targets and smooth out the experience. I also took a stab at the Windows target, although it's not tested.

The rest of the details are on my personal blog here:
https://codesnip.sh/posts/building-standalone-nodejs-executables

The script demonstrates using Webpack for bundling. I plan to also add esbuild and swc support, but you can just use the project as a starting point for your own project.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more