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
I am building a library of React components that I'd like to publish without automatic JSX runtime. In previous versions of vite and @vitejs/plugin-react I was able to build my library without vite polluting my dist directory with JSX runtime junk. I updated both vite and @vitejs/plugin-react and the option to use classic jsxRuntime does not work as expected in combination with jsx option in typescript.config.ts.
The option jsx: 'preserve' in typescript.config.ts returns a Rollup error.
The option jsx: 'react-jsx in typescript.config.ts pollutes my dist directory with JSX runtime junk.
The option jsx: 'react' keeps dist clean, but only in my reproduction case. Locally, where I have dozens of components, it adds JSX runtime junk.
This used to work in earlier versions of vite and @vitejs/plugin-react
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
With jsx: 'react' option set in my library, I still see JSX runtime files in my dist directory:
I also use [email protected] in my library to document components. It reuses my vite.config.ts but I use .jsx extension since their TS types are still in the state of flux and cause TS errors. But my stories are outside of src directory and are not taken into consideration during npm run build process.
Describe the bug
I am building a library of React components that I'd like to publish without automatic JSX runtime. In previous versions of
vite
and@vitejs/plugin-react
I was able to build my library withoutvite
polluting mydist
directory with JSX runtime junk. I updated bothvite
and@vitejs/plugin-react
and the option to useclassic
jsxRuntime does not work as expected in combination withjsx
option intypescript.config.ts
.I have externalized both
react
andreact-dom
as described in the docs.The option
jsx: 'preserve'
intypescript.config.ts
returns a Rollup error.The option
jsx: 'react-jsx
intypescript.config.ts
pollutes mydist
directory with JSX runtime junk.The option
jsx: 'react'
keepsdist
clean, but only in my reproduction case. Locally, where I have dozens of components, it adds JSX runtime junk.This used to work in earlier versions of
vite
and@vitejs/plugin-react
Reproduction
https://stackblitz.com/edit/vitejs-vite-kosz8e?terminal=dev
Steps to reproduce
Go to reproduction link and run
npm run build
with different options described above.System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: