You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dependencies that have export conditions for node and the browser are resolving to node even when running tests in JSDOM. This can cause the packages to not behave as intended running the browser code in the JSDOM environment instead of the node code targeting SSR use cases.
Reproduction
This is related to this issue. Here is a repo that demonstrates the issue.
This is intentional. The ecosystem doesn't have a consensus on how exports conditions are used. Vitest follows the idea that it should only apply if output code is executed in the browser. Even though JSDOM emulates browser globals, it doesn't change how imports are working.
But you can always manually add any condition to resolve.conditions field:
Describe the bug
Dependencies that have export conditions for node and the browser are resolving to node even when running tests in JSDOM. This can cause the packages to not behave as intended running the browser code in the JSDOM environment instead of the node code targeting SSR use cases.
Reproduction
This is related to this issue. Here is a repo that demonstrates the issue.
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: