-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
Make --input-type=module work in general #44457
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
Comments
Do you think this issue could be suitable for a new contributor? If so, I would like to be assigned to it and give it a try. |
Duplicate of https://github.com/nodejs/node/discussions/37857. The TL;DR I think can be summarise by:
I'm going to close this to keep the discussion in the other thread, feel free to continue there. |
That thread has heavily derailed with massive scope creep including things like "what to do when there is no extension", "adding a completely different This is a very clear, well scoped request to extend |
Node.JS is currently unable to execute standard JS. |
The link above seems to be completely missing (404): https://github.com/nodejs/node/discussions/37857 Can we re-open this issue perhaps? In emscripten it would be very useful for building command line JS applications that can be run via |
What is the problem this feature will solve?
Node cannot be used for one-time runs of ESM code in "no package.json" context or in CJS projects, or conversely in CJS mode in ESM projects, because
--input-type
is ignored when node is told to run a file rather than a string.This includes not being able to run third party scripts in a project that has been written in "the other flavour" without transpiling, which makes very little sense when Node knows how to run both flavours of JS just fine, and just has no way to make it do so on a per-run basis.
What is the feature you are proposing to solve the problem?
Updating
--input-type
to apply to both strings and files, so thatnode --input-type=module onetimescript.js
runs in ESM mode for that single run would be incredibly useful.What alternatives have you considered?
There are no alternatives for telling Node which mode to run in on a per-run basis.
The text was updated successfully, but these errors were encountered: