Skip to content

Commit c719e5d

Browse files
authored
perf(react): skip transform hook completely in rolldown-vite in dev if possible (#783)
1 parent e622a6a commit c719e5d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/plugin-react/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
### Skip transform hook completely in rolldown-vite in dev if possible ([#783](https://github.com/vitejs/vite-plugin-react/pull/783))
6+
57
## 5.0.1 (2025-08-19)
68

79
### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](https://github.com/vitejs/vite-plugin-react/pull/735))

packages/plugin-react/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ export default function viteReact(opts: Options = {}): Plugin[] {
208208
staticBabelOptions = createBabelOptions(opts.babel)
209209

210210
if (
211+
(isRolldownVite || skipFastRefresh) &&
211212
canSkipBabel(staticBabelOptions.plugins, staticBabelOptions) &&
212-
skipFastRefresh &&
213213
(opts.jsxRuntime === 'classic' ? isProduction : true)
214214
) {
215215
delete viteBabel.transform
@@ -269,8 +269,7 @@ export default function viteReact(opts: Options = {}): Plugin[] {
269269

270270
const isJSX = filepath.endsWith('x')
271271
const useFastRefresh =
272-
!isRolldownVite &&
273-
!skipFastRefresh &&
272+
!(isRolldownVite || skipFastRefresh) &&
274273
!ssr &&
275274
(isJSX ||
276275
(opts.jsxRuntime === 'classic'

0 commit comments

Comments
 (0)