-
-
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
jest-resolve can't handle "exports" #10422
Comments
Facing the same with |
I agree, Firebase with full Jest support would be desirable. Any current work arounds for exports? |
Duplicate of #9771. I haven't had time to work on ESM support in general for the last few months, and the immediate future doesn't look any more promising in that regard, unfortunately... Any help via PRs or research is of course welcome. |
I found this post after the same happened to me.
exporter lib config
I found an easy way to implemente a workaround. Hope it can help someone until Jest add support for this case.
but I got, can't find module error. Since Jest does not supports I try change my import to
It worked, but still far from elegant, so I also added this to my Jest config file
And now I can do this as it supposed to be from start
|
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
"exports" field seems to be ignored by jest-resolve, resulting with unexpected "Cannot find module ..." error thrown even though Node is capable of resolving the paths.
https://nodejs.org/api/esm.html#esm_package_entry_points
To Reproduce
Steps to reproduce the behavior:
I have a simple utils package in my workspace, that's shaped like this:
package.json:
This allows me to use it in my main project by importing utils like this:
This works both in native ES modules environment in Node 14, and in code transpiled by Babel. But this code crashes in Jest tests.
Expected behavior
"exports" to be respected and understood by jest-resolve
Link to repl or repo (highly encouraged)
https://github.com/wojtekmaj/resolve-exports-issue
envinfo
The text was updated successfully, but these errors were encountered: