tapjs/processinfo

only add loader to `NODE_OPTIONS` if not already in argv

Opened this issue · 0 comments

In cases where processinfo is used along with a transpiling loader with a load hook returning { source, format, shortCircuit: true }, then the @tapjs/processinfo loader must come last in the argument list, so that it can call nextLoad and record based on the result.

However, if the processinfo loader is in NODE_OPTIONS, then it will be first in the list, making it so that it never gets called in the load hook chain, and the file is not recorded.

The solution: only add the pi loader to NODE_OPTIONS env if it is not already present in argv.