-
-
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
[Bug]: Jest resolves browser version of modules instead of node #12770
Comments
Yeah, this is known as That said, there is a PR for |
I'll add it to the upgrade guide |
Tweaked docs in #12771 🙂 |
Thanks for quick response @SimenB! |
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. |
Version
28.0.2
Steps to reproduce
When the tests run, they fail because the browser version of both
uuid
- andnanoid
-packages are loaded.There seems to be an issue/change with how modules are resolved in Jest 28.
Expected behavior
Expected the tests to pass and that the node-versions of the packages
uuid
andnanoid
to be loaded.Actual behavior
The tests failes to execute with the following error message.
The root cause seems to be that
dist/esm-browser/index.js
is loaded instead of the node version.Additional context
Since the tests fail because of parsing error, I tried adding the following jest-config to transform the
uuid
-module.This fixes the parsing errors, but fails with a new error:
I also tried adding a custom resolver to load the correct version of UUID:
This jest.config.js manages to load the correct version of UUID, but yields error for
nanoid
:I've had no success in creating a workaround for
nanoid
so that the correct node-implementation ofnanoid
gets loaded.Environment
The text was updated successfully, but these errors were encountered: