-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
jsxImportSource not work in jsdom enviroment with local files #4141
Comments
Also encountering this issue, removing EDIT: Hmmm seems like my discoveries were of import meta resolve returning a URL instead of a string were reported and fixed by node already nodejs/node#49695 |
It looks like there was some change around Probably the reason why Forcing From a different point of view, I think more robust way to mitigate this issue is to avoid relative path for custom jsx runtime since you don't know how it will be injected by babel transform. Probably this is somewhat analogical to how https://stackblitz.com/edit/github-c58amn-wfeq4e?file=vite.config.ts |
@hi-ogawa is correct. The plugin (which is outside of Vitest control) just injects the string without resolving it. Don't use relative paths. |
Describe the bug
jsxImportSource
option in@vitejs/plugin-react
not work with local files with jsdom, happy-dom etc starting from version 0.34. There is errorError: Failed to resolve import "./src/jsx/jsx-dev-runtime"
. To fix this error you canvitest
0.33// @vitest-environment jsdom
Reproduction
https://github.com/utftu/vitest-jsx
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: