- Version: v12.5.0
- Platform: Mac
- Subsystem: worker_threads
Steps to reproduce:
- Create two scripts, a.js:
const { Worker } = require('worker_threads');
const worker = new Worker('console.log(42)', { eval: true, data: {} });
and b.js:
const { isMainThread } = require('worker_threads');
console.log('b', isMainThread);
- Run
node --require b.js a.js
- Take a look on output:
I am wondering is it feature or bug that we inject --require module to workers. If it is feature, should we mention it in workers doc and in --require flag description?
In my use case - I use --require to implement inspector socket discovery in user land - I need --require only for main thread. I can workaround it on my side but do we need some additional flag that will inject to workers instead of reusing existing flag.
Steps to reproduce:
and b.js:
node --require b.js a.jsI am wondering is it feature or bug that we inject
--requiremodule to workers. If it is feature, should we mention it in workers doc and in--requireflag description?In my use case - I use
--requireto implementinspectorsocket discovery in user land - I need--requireonly for main thread. I can workaround it on my side but do we need some additional flag that will inject to workers instead of reusing existing flag.