-
-
Notifications
You must be signed in to change notification settings - Fork 179
fix(react): respect tsconfig jsxImportSource by default #726
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
Conversation
packages/plugin-react/src/index.ts
Outdated
runtime: 'automatic', | ||
importSource: jsxImportSource, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to remove runtime
too since rolldown-vite merge oxc option with tsconfig only when runtime === undefined
. Is this intended or allow also runtime === 'automatic'
? @sapphi-red https://github.com/vitejs/rolldown-vite/blob/f88cb05e755457fd9ea99174a017c49964510c3f/packages/vite/src/node/plugins/oxc.ts#L65-L68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the vite-rolldown code as is, this would mean that users having jsx === 'preserve'
in tsconfig will now have broken apps I think.
Is this also the same logic for the esbuild?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know react plugin is ensuring automatic
so that tsconfig's jsx preserve will be ignored. Probably rolldown-vite oxc option merging needs to be tweaked. I'll also add that test case too then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know react plugin is ensuring automatic so that tsconfig's jsx preserve will be ignored
I'm not sure it's a goal, but with the current implementation of vite-rolldown it happen to be the case.
|
…`oxc.jsx.runtime` is set (#5771) This PR ports vitejs/rolldown-vite#376 to builtin transform plugin to fix vitejs/vite-plugin-react#726
…`oxc.jsx.runtime` is set (#5771) This PR ports vitejs/rolldown-vite#376 to builtin transform plugin to fix_ vitejs/vite-plugin-react#726
@hi-ogawa I've released rolldown-vite v7.1.3, which includes the fixes. |
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
3948fc1
to
ea00b55
Compare
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "@emotion/react", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can update the playground/emotion to comment the manual jsxImportSource (saying we expect to be infered from tsconfig)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I should reuse that but I'm not sure how to get esbuild to pickup tsconfig for jsx. I'll update the example to tsx in a later PR and remove this one.
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.7.0 | 5.0.1 | ## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19) ##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735)) `optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`. ##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734)) ##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726)) ##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716)) ##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708)) ##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689)) ## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.7.0 | 5.0.1 | ## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19) ##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735)) `optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`. ##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734)) ##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726)) ##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716)) ##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708)) ##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689)) ## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.7.0 | 5.0.1 | ## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19) ##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735)) `optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`. ##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734)) ##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726)) ##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716)) ##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708)) ##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689)) ## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.7.0 | 5.0.2 | ## [v5.0.2](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#502-2025-08-28) ##### Skip transform hook completely in rolldown-vite in dev if possible ([#783](vitejs/vite-plugin-react#783)) ## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19) ##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735)) `optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`. ##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734)) ##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726)) ##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716)) ##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708)) ##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689)) ## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.7.0 | 5.0.2 | ## [v5.0.2](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#502-2025-08-28) ##### Skip transform hook completely in rolldown-vite in dev if possible ([#783](vitejs/vite-plugin-react#783)) ## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19) ##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735)) `optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`. ##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734)) ##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726)) ##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716)) ##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708)) ##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689)) ## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
Description
jsxImportSource
settings from tsconfig #719oxc.jsx.runtime
is set rolldown-vite#376oxc.jsx.runtime
is set rolldown/rolldown#5771