-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change in NODE_OPTIONS parsing behavior in Node 11 #26521
Comments
@arcanis Do you want to continue work on your PR and fix this along with it? Otherwise we can do a new PR for this specific problem? |
I'll give it a look this evening (I might have to revert part of 8ec3c35 since it wouldn't make sense to use the same |
@arcanis I think both consumers of |
@rwjblue thanks for debugging this one! |
Can we make |
maybe we should ignore white spaces like this on if (item.empty()) continue; |
I've rebased, updated, and fixed this issue in #24065 |
fixed on 17ab2ed |
@himself65 / @arcanis is the plan to ship this as part of an upcoming [email protected] release? |
i don’t know :( you can ask the Node Team Members about it. |
cc @addaleax ^ |
@stefanpenner it seems this shipped with Node.js 11.12.0. I'm going to close this. Please comment back if needed. |
When a script is invoked by yarn, it provides the appropriate -r via NODE_OPTIONS. This makes all node scripts invoke via yarn automatically pnp aware. Unfortunately NODE_OPTIONS was partially broken in node 11, preventing this from working. Luckily node 11.12 fixed this issue. Relevant issue: nodejs/node#26521
When a script is invoked by yarn, it provides the appropriate -r via NODE_OPTIONS. This makes all node scripts invoke via yarn automatically pnp aware. Unfortunately NODE_OPTIONS was partially broken in node 11, preventing this from working. Luckily node 11.12 fixed this issue. Relevant issue: nodejs/node#26521
If
NODE_OPTIONS
starts with a leading space the--require
option does not function (possibly other flags but I've only tested--require
).Specifically:
NODE_OPTIONS="--require ./some-file.js" node ./other-file.js
^ will properly require
./some-file.js
prior to executing./other-file.js
Whereas:
NODE_OPTIONS=" --require ./some-file.js" node ./other-file.js
^^ will not require
./some-file.js
at allSteps to reproduce:
Then compare the output of these two commands:
I stumbled across this while attempting to use Yarn's PnP system on Node 11 (see yarnpkg/yarn#7092 for the original report there). Yarn 1.13.0 adds
--require ${PATH_TO_PNP_FILE}
toNODE_OPTIONS
which causes this issue./cc @arcanis @Turbo87 @stefanpenner
The text was updated successfully, but these errors were encountered: