node
node copied to clipboard
sea: only assert snapshot main function for main threads
Snapshot main functions are only loaded for main threads in single executable applications. Update the check to avoid asserting it in worker threads - this allows worker threads to be spawned in snapshot main functions bundled into a single executable application.
(Also noticed that worker_threads cannot be loaded in the snapshot builder script, which is to be expected currently since we haven't vetted the worker_threads module for snapshot building. I left a FIXME on how to vet the worker internals and make it loadable in the snapshot builder).
Fixes: https://github.com/nodejs/node/issues/56077