-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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 flexible node script names in esm #37512
Comments
@rektide can you expand a bit more on the version of Node.js you are using and if you perhaps have a rogue package.json with On my system with a stock installation of Node.js 12 / 14 / 15 the extensionless script works as expected. edit: sorry about closing, mistype |
@MylesBorin i am trying to use esm at the same time. that's definitely a compounding factor; should have mentioned that. i have updated the issue to be more esm specific & to not regard this as a regression. thank you. i am on version 12.20.2 atm, happy to test others. perhaps the final option might be a sensible-ish one? there don't need to be separate binaries. but if node is symlinked then run as
one other option (that i added to the list), seemingly less radical: i tried using
if it were possible to relax this we could make
|
This behaviour is also breaking other tools assumptions, such as Emscripten (emscripten-core/emscripten#13551). Other alternatives to solve this:
|
I had someone reach out to me recently with a related but different problem where their extensionless executable scripts are now failing if a package.json end up anywhere between their script and the root of the file-system that is "type": "module". Thinking through a couple different potential solutions |
Is your feature request related to a problem? Please describe.
I like to write esm scripts that users can use in Node.js. Pre-esm Node would allow this & just work. But there does not seem to be an esm-supporting way to do this. Previously I could make a short script
hello-world
:And running it
./hello-world
would work. Today if I do that with an module type script, I get:I do not want to subject my users to having to have every random utility I write end in .js: that adds no value to the user.
Describe the solution you'd like
Please allow unknown (or even just non-present) file extensions to be evaluated as javascript, using the same module or common heuristic as if it were a .js file.
Describe alternatives you've considered
--input-type=
to work even if a file is specified (presentlycan only be used with string input via --eval, --print, or STDIN
)nodecjs
nodemjs
nodewasm
nodenode
use the specified format. Symlink these names to the node binary.The text was updated successfully, but these errors were encountered: