-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
ESM doesn't load module in NODE_PATH #38687
Comments
This was done intentionally IIRC, and is documented here: https://nodejs.org/api/esm.html#esm_no_node_path Closing as there's no bug here, but feel free to continue the discussion or reopen if you think the documentation can be improved. |
Related discussion: nodejs/modules#534 |
|
nodejs/modules#534 (comment) gives some suggestions on how to workaround this limitation. If symlinks are a pain to put in place, you could have a
I think it's because it was simplifying the PACKAGE_RESOLVE algorithm, and no one complained for the lack of this feature during the development of the ESM implementation. |
OK thx for information. |
If you’re using experiemental ES Module loaders, one workaround is to carry out module resolution yourself for those modules that you want to include from a different path. |
What steps will reproduce the bug?
set NODE_PATH=C:\foo
node test.js
Files
How often does it reproduce? Is there a required condition?
Everytime
What is the expected behavior?
Load the module as if it was not in other directory.
it says
Did you mean to import bar/baz.js?
. Yes it's what I want in result ofimport { b } from "bar/baz.js";
.What do you see instead?
Additional information
The text was updated successfully, but these errors were encountered: