-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
--import
flag for Node.js parity
#1909
Comments
--import
flag--import
flag for Node.js parity
I'm facing the same issue as I'm trying to debug TypeScript |
Need to bump this, it is quite annoying to see these lines
Shouldn't be that hard to convert to an import flag and expose that. |
Hi, I work on Node.js. The To do so, you could create a new export from your package that calls const { register } = require('node:module');
const { pathToFileURL } = require('node:url');
register('./esm.mjs', pathToFileURL('./')); This file could also register the CommonJS hooks if you want to cover everything; and then your README wouldn’t need separate instructions for CommonJS and ESM. If you create this and update your README accordingly, you will be future-proofing your package and removing reliance on Node experimental flags. |
Are there any reason why this should not be implemented?
|
I understand time is scarce and maintainers are doing their best, but setting up
Wheras |
Yes @sliekens , I believe that |
Desired Behavior
Should work exactly as node's
--import
flag, optionally an-I
alias.Alternatives you've considered
Running
node --loader ts-node/esm
with a local file path results in an error:Additional context
Node.js recently added the
--import
flag in v19.The text was updated successfully, but these errors were encountered: