-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Self-reference / import of the current package doesn't work in an mjs file, but does in a ts file in src #50270
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
@andrewbranch is this just "not a bug", then, per #50390? I guess I'm surprised, as I had assumed we'd recognize that mjs can do this, but... |
This is totally separate from #50390—that repro was not showing what it looked like it was showing. It was just misconfigured. |
This seems configuration error..
|
Yes, I am opening this up in VS Code, so I suppose this is the default project. I guess I would have expected that |
Then the question is, why isn’t |
Oh wait, you don’t have I also don’t know if |
Adding |
Specifically, once I enable the option and open the file, about 10 duplicate errors that say "cannot write file because it would overwrite input file" appear in my tsconfig.json. So, maybe it's not trying to write to dist, and I just don't know how to configure my project. 😅 |
In that case, I would call this a duplicate of #49270 (I could update the title to include |
Sounds good to me. |
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
node16 nodenext esm mjs self reference referential module package name
🔎 Search Terms
🕗 Version & Regression Information
💻 Code
Repro here: https://github.com/jakebailey/self-reference-mjs
In short, I have a
mjs
file with:And a
package.json
like:This code executes and does the right thing, but TS gives an error on the import. Writing the same code in a TS file works, but the emitted code is identical to the hand-written code.
🙁 Actual behavior
I can import the current package by name in an mjs file.
🙂 Expected behavior
I can only import the current package in TS, not in an mjs file.
I sort of expected this to work post #46762 or something, but the behavior is inconsistent.
The text was updated successfully, but these errors were encountered: