These are compiled from my fork of node. The binaries below add support for source code bundling. They accomplish this by checking for trailing zip archives at the end of the executable. Shared libraries will be loaded via temporary files on disk, but other files will be loaded from memory.
Something to note is including assets in your bundle is likely to break it for now (such as .html files).
This is due to loading files from memory.
However, if you need to / want to patch this to work you can use require.readResourceSync(path)
or require.createReadStream(path)
Discussion with the core node team is in the works for standardizing these methods.
# create our zip
# will be opened as if you had called `node $PATH_TO_MY_MODULE`
zip -r bundle.zip $PATH_TO_MY_MODULE
# add trailing zip archive to bundled node
cat node_bundled bundle.zip > node_bundle
# make bundled node executable
chmod +x node_bundle
# run
./node_bundle
$TMPDIR || "./tmp"
make sure you have permissions to write there.
NODE_CHANNEL_FD
exists (such as using child_process.fork())
, the archive will not use the main
file from the archive's package.json