-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Description
Affected URL(s)
https://nodejs.org/api/cli.html#-r---require-module
Description of the problem
There was a previous issue for this:
#28518
But the PR to improve this does not make this clear in the right places:
#31380
When using these args, it's important to understand their impact.
My understanding is that these arguments impact:
- The main thread (obvious!)
- All worker threads unless you specifically pass
execArgv: []
to options - All processes created by
child_process.fork()
unless you passexecArgv: []
to options - All processes created by the
cluster
module unless you pass `execArgv: [], to settings
As requested in the previous issues, this behaviour should really be documented under --require
docs here:
https://nodejs.org/api/cli.html#-r---require-module
and also for the --import
docs here:
https://nodejs.org/api/cli.html#--importmodule
It might also be worth linking to this warning from both of those args because this is information is key and hidden right at the bottom of the worker thread docs:
https://nodejs.org/api/worker_threads.html#launching-worker-threads-from-preload-scripts