esm: spawn only one hooks thread
Our intent with moving module customization hooks into a separate thread was that one such “hooks thread” would be spawned regardless of however many worker threads the user’s application code spawned. On current main
this is not the case; a new hooks thread is created alongside each new worker thread.
This PR aims to fix that, but currently all I have is a test that fails on current main
but should pass, once this bug is fixed. I’m opening this as a placeholder for when a fix is ready, and I encourage anyone who wants to take a crack at it to help make this test pass. I’m happy to let others push commits on my branch.
cc @nodejs/loaders @nodejs/workers