-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Setting build mode to "development" breaks React JSX transform #5885
Comments
I also get this error any time I run the Vite versions from package.json:
|
Same here, this is stacking atop other problems preventing production deployments.. |
Found a workaround for that: plugins: [
process.env.MODE !== 'production' ? react({
jsxRuntime: 'classic',
}) : react(),
svgLoader(),
], NODE_ENV=development MODE=development yarn run vite build |
run into the same issue here. the above workaround does work tho. |
@pcdummy 's fix worked for me. |
Describe the bug
If
"mode": "development"
is specified invite.config.js
, and the project uses React JSX - then this results in a broken build, which displays in the console the following error when it first encounters a JSX tag:jsxDevRuntime.exports
at that point do indeed havejsxDEV
value set to undefined. Looks like some part of the transform is not being set to development mode in this case, and doesn't producejsxDEV
data.This seems similar to vercel/next.js#19001, but setting
NODE_ENV
environment variable todevelopment
did not resolve the issue here.This problem has also been brought up in discussion #5803, and it makes it impossible to debug or find the culprit of broken production builds described in #2139.
Is there any workaround to get development-mode build working, however hacky it might be?
Reproduction
https://github.com/morhekil/vite-bug-example
This is just a trimmed down standard initial Vite repo
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: