Skip to content

Instantly share code, notes, and snippets.

@EntityPlantt
Last active February 21, 2024 20:09
Show Gist options
  • Save EntityPlantt/ca6ac79e789750383fde1b03199eaea0 to your computer and use it in GitHub Desktop.
Save EntityPlantt/ca6ac79e789750383fde1b03199eaea0 to your computer and use it in GitHub Desktop.
Creates a single executable application from a single JS file; see https://nodejs.org/api/single-executable-applications.html
console.log(`Hello! Running Node!!`);
for (var i of [1, 2, 3, 4, 5, 6]) {
console.log("this is an experimental feature");
}
node --experimental-sea-config sea-config.json
cp $(command -v node) output
pnpx postject output NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
{
"main": "node-sea.js",
"output": "sea-prep.blob"
}
@EntityPlantt
Copy link
Author

Run: bash build.sh, sh build.sh, ./build.sh or any other way (just run the script)
Creates file tree:

  • output (executable)
  • sea-prep.blob (blob with script data)

Requires Node v18.6.0 or later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment