Introduction to snapshot flags in Node.js v18.8.0
Blog post from LogRocket
Node.js has introduced an experimental feature in version 18.8.0 that allows for generating run-time user-land snapshots, providing a new way to create a single binary containing both Node.js and an embedded snapshot without building Node.js from the source. This feature, facilitated by the new --build-snapshot and --snapshot-blob flags, streamlines the startup process by embedding the initialized heap state of an application into the binary, thus eliminating the need for additional initialization steps, which enhances performance compared to traditional packaging solutions like pkg. The feature contrasts with the build-time snapshots enabled by the --node-snapshot-main flag, which requires building Node.js from the source and is less user-friendly. Despite its current limitations and experimental status, this feature holds promise for the Node.js community by potentially reducing app startup times and simplifying deployment processes.