-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Extenstionless main files and ES modules interaction #33223
Comments
@nodejs/modules-active-members |
This is intentional. See #31415. The intent is to preserve the ability for extensionless files under The workarounds are to either make a symlink (e.g. |
The problem is that node is supposed to be treating the The addition of the To reproduce on node v14.0.0:
|
Do you mind please opening a new issue for this? I think it'll get lost in this one. |
What steps will reproduce the bug?
Create file
package.json
:Create file
main
(no extension):Run:
node ./main
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
main
file to be executed.What do you see instead?
Additional information
This works in version 12. But does not work in versions 13 and 14.
--experimental-specifier-resolution=node
flag does not help.Real world example: we have mocha (which main entry file is extensionless), we have ts-node esm-loader, now we want to test ts files with native es modules, like that:
node --loader ts-node/esm.mjs node_modules/mocha/bin/mocha --extension ts
but we get the error described above. But if we rename
node_modules/mocha/bin/mocha
tonode_modules/mocha/bin/mocha.js
, then everything works as expected.The text was updated successfully, but these errors were encountered: