-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Allow --inspect flag to be provided after script name #11028
Comments
I'm -1 on this because it places unnecessary restrictions on user scripts for a minor "inconvenience." |
@mscdex could you elaborate? Do you mean that if you "fix" this then you can't pass |
@gibfahn I think the issue is if Node starts swallowing arguments after the script, it will lead to confusing behavior in user-land. What if For example, if Seth-Laptop:tmp sholladay$ node myscript.js
[ '/usr/local/Cellar/node/7.4.0/bin/node',
'/private/tmp/myscript.js' ]
Seth-Laptop:tmp sholladay$ node --inspect myscript.js
[ '/usr/local/Cellar/node/7.4.0/bin/node',
'/private/tmp/myscript.js' ]
Seth-Laptop:tmp sholladay$ node myscript.js --inspect
[ '/usr/local/Cellar/node/7.4.0/bin/node',
'/private/tmp/myscript.js',
'--inspect' ] The consequences of changing the above output would be severe. |
Wouldn't that mean that "scripts": {
"regular": "node $NODE_OPTIONS myscript.js",
"debug": "NODE_OPTIONS=--inspect npm run regular"
} |
@gibfahn Correct, you at least couldn't use I just think there's too much potential breakage for such little gain. I think a better solution would be something less intrusive, like an environment variable or something. |
I'm going to go ahead and close as I don't see this as being something we can do without breaking a large part of the ecosystem. Thanks! |
Okay cool, thanks for the quick response all. |
Currently, only this works
It seems dumb that the following shouldn't work
This becomes especially important when doing complex npm run scripts with passed arguments. For instance, if this feature existed, then we could define a regular run-script and a debug run-script in our package.json, like so
But this fails for the reasons described above.
Also, it just makes sense that order shouldn't matter with command line flags.
The text was updated successfully, but these errors were encountered: