-
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
Compare with REPL, "node -p" & "node -e" has different default imports packages #4069
Comments
This is documented as a repl-only feature: https://nodejs.org/api/repl.html#repl_repl_features |
We could maybe add a cli flag for this? @rufushuang would that be acceptable? something like |
@evanlucas did you ever get around to working more on the options parser? What part of the work in blocking progress? |
I have played with it on and off. I'm having a lot of difficulty making sure that it is backwards compatible though (particularly the |
@evanlucas hmmm, ok. Just as a note, special casing a thing or two might not be bad overall for now. |
Fwiw this request is actually pretty tricky. |
You could always do this:
|
Sorry for the late reply, i kinda understand this is backwards compatible consideration. If it's same package imports, both the direct file execution and "-p"/"-e" option. Then remain this request as the only REPL feature is OK. Maybe some more documents on "-p"/"-e" options? |
I think there should be an extra CLI option for this. :) |
I think this has been resolved by #6207? Sorry, I didn’t see this issue before, originally the PR wasn’t supposed to change anything for the repl. @Fishrock123 @evanlucas You commented both here and there, do any of the concerns voiced here apply? |
Sounds like this can be closed. |
When in REPL, we can use packages such as fs, vm directly by default.
But in "node -p"/"node -e", must require these packages manually
returns "fs is not defined"
This makes command line script running such a pain...
Try "node -p", then "not defined" one found, and then require the missing package manually. Repeat this again and again.
The text was updated successfully, but these errors were encountered: