Skip to content

Commit 327be59

Browse files
committed
fix(react): compat with newer rolldown
1 parent 62044c8 commit 327be59

File tree

4 files changed

+178
-9
lines changed

4 files changed

+178
-9
lines changed

packages/plugin-react/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
SSR applications can now initialize HMR runtime by importing `@vitejs/plugin-react/preamble` at the top of their client entry instead of manually calling `transformIndexHtml`. This simplifies SSR setup for applications that don't use the `transformIndexHtml` API.
88

9+
### Fix raw Rolldown support for Rolldown 1.0.0-beta.44+ ([#930](https://github.com/vitejs/vite-plugin-react/pull/930))
10+
11+
Rolldown 1.0.0-beta.44+ removed the top-level `jsx` option in favor of `transform.jsx`. This plugin now uses the `transform.jsx` option to support Rolldown 1.0.0-beta.44+.
12+
913
## 5.0.4 (2025-09-27)
1014

1115
### Perf: use native refresh wrapper plugin in rolldown-vite ([#881](https://github.com/vitejs/vite-plugin-react/pull/881))

packages/plugin-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"babel-plugin-react-compiler": "19.1.0-rc.3",
6060
"react": "^19.2.0",
6161
"react-dom": "^19.2.0",
62-
"rolldown": "1.0.0-beta.43",
62+
"rolldown": "1.0.0-beta.44",
6363
"tsdown": "^0.15.8"
6464
}
6565
}

packages/plugin-react/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ export default function viteReact(opts: Options = {}): Plugin[] {
225225
},
226226
options(options) {
227227
if (!runningInVite) {
228-
options.jsx = {
229-
mode: opts.jsxRuntime,
228+
// @ts-expect-error Rolldown has `transform.jsx`
229+
options.transform ??= {}
230+
// @ts-expect-error Rolldown has `transform.jsx`
231+
options.transform.jsx = {
232+
runtime: opts.jsxRuntime,
230233
importSource: opts.jsxImportSource,
231234
}
232235
return options

0 commit comments

Comments
 (0)