Sharing my project's build script in case it's useful to others. I'm not testing for Windows, which is why the script reports an error, but just note that emitting Windows executables is actually supported by the Node API (see docs). Feel free to use and modify.
Notes
- Webpack is used for bundling.
- The entry point for the webpack config for my example is
./bin/app
, which was an executable Node.js script with a shebang line. Update the config to point to whatever your app's entry point is. - The SEA config file uses
disableExperimentalSEAWarning
to suppress the experimental warning displayed when running a generated executable. This didn't work for Node 20.1.0 (see issue), but it has been tested and does work for 21.1.0.