-
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
module import errors follow different logic than importing #51216
Comments
import { four } from "./foo.mjs"; console.log(four()); The imported path is wrong. |
This doesn't work;
If that is the case, the error message should reflect that. Instead, the error message suggests that I import If the code is wrong, then the error message suggestion is wrong as well. Error messages shouldn't suggest bad code. Hence the bug. |
Hello im a new contributor! ill get to finding the source of the bug and fix it :) |
PR-URL: #51223 Fixes: #51216 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #51223 Fixes: #51216 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #51223 Fixes: #51216 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: James M Snell <[email protected]>
Version
v21.4.0
Platform
linux
Subsystem
No response
What steps will reproduce the bug?
File
main.mjs
File
node_modules/foo.mjs
:Result:
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
I would expect one of:
What do you see instead?
The error message tries to be helpful and suggests I try to import from
foo.mjs
, but that's exactly what I'm already doing. It seems like node can see there is afoo.mjs
to import when printing an error message but not when doing the actual import. The error messaging and the importing should follow the same logic so as to give helpful error messages.Additional information
No response
The text was updated successfully, but these errors were encountered: