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.
 

 
                       
    
Top comments (0)