-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
require()
ing a file shouldn't automatically make it CJS
#11258
Comments
Good catch 👍 I'll fix some time during Easter 🙂 |
I see that Easter is sooner than expected 😛 |
🐣 |
@nicolo-ribaudo released in |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
When a
.js
file is required withrequire()
, Jest assumes that it's a CJS file even when it is an ESM file.To Reproduce
See repo below
Expected behavior
It should log
ERROR! [ERR_REQUIRE_ESM] Must use import to load ES Module:
becauseesm-dep.js
is an ESM file, but it logsIMPORTED! { foo: 2 }
.Link to repl or repo (highly encouraged)
https://github.com/nicolo-ribaudo/jest-bug-require-esm
Note that
package.json
contains"type": "module"
.envinfo
Ref #9430 (comment)
The text was updated successfully, but these errors were encountered: