Use IPC to notify child of hot update
wmertens opened this issue · 3 comments
Since cluster
uses childProcess.fork
, you can send messages to the child. This could be used to tell the hot infra that there was an update.
That way, the polling setup isn't necessary and updates would be instant. It would require a custom hot module to receive the messages.
Because of #12 it might actually be better to not fork at all, and run the script in-process. It would still need a little bit of code to tell the hot handler about the newly compiled code.
You should not need a custom hot module to send a signal to the child process...
You should be able to use webpack/hot/signal
instead of webpack/hot/poll
and then just send a signal to the worker process in the after emit hook.
Im gonna submit a PR soon for you to take a look at...