-
Notifications
You must be signed in to change notification settings - Fork 47k
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: react 16 and 17 not working in ESM env with TypeScript #25857
Comments
look it |
It doesn't look like this bug report has enough info for one of us to reproduce it. Please provide a CodeSandbox (https://react.new), or a link to a repository on GitHub. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve |
The support of ESM was added in 18, it is not there in 16 and 17. |
Here is a repro: https://github.com/cyberuni/react-16-vite-ts-issue pnpm i
pnpm vitest |
Adding this to "exports": {
".": {
"default": "./index.js"
},
"./package.json": "./package.json",
"./jsx-runtime": "./jsx-runtime.js",
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
"./src/*": "./src/*"
}, However I can't modify the code and commit because when trying to do a Response code 404 (Not Found) for https://github.com/electron/electron/releases/download/v9.1.0/electron-v9.1.0-darwin-arm64.zip |
dup of #20235 with some workarounds: |
Note that the workaround for This is because The workaround in {
test: {
deps: {
inline: ['dep-package']
}
}
} |
React version: 16 and 17
Reference: vitest-dev/vitest#2468
Steps To Reproduce
vite
)react-jsx
typescript settingThere will be error of "Cannot find module" for
react/jsx-runtime
The current behavior
Not working, needs workaround
The expected behavior
Should work.
I can help with PR to add the
exports
field to React 16/17.The text was updated successfully, but these errors were encountered: