node-dev
node-dev copied to clipboard
support registering hook in worker threads
This provides a better implementation for #285 by setting and reading the main script from process.env. This allows modules require
d from threads to trigger reloads.
I considered some alternative solutions where we monkeypatch into the Worker
constructor, but ultimately I think an env variable solves this well
Hi @bjornstar! Could this get a review please?
I'd like to see a test so we can validate it's working.
After adding a test case, I realized that it wasn't actually working as I expected - worker threads don't seem to inherit IPC handles, so I had to adapt the ipc.js helper to set up a new MessagePort
as well.