Describe the bug
Importing package in both main and worker thread will cause Error: Module did not self-register.
It will works if only main or worker thread is importing the package.
To Reproducemain.js
import { Worker } from 'worker_threads';
import ZooKeeper from 'zookeeper';
console.log('Hi from main.js!');
const worker = new Worker('./worker.js');
worker.js
import ZooKeeper from 'zookeeper';
console.log('Hi from worker.js!');
Describe the bug Importing package in both main and worker thread will cause Error: Module did not self-register. It will works if only main or worker thread is importing the package.
To Reproduce main.js
worker.js
package.json
Screenshots
Desktop (please complete the following information):
Additional context Hopefully this thread can provide some clue. https://github.com/nodejs/node/issues/21783