Skip to content

Commit 4bec551

Browse files
authored
fix: use optimizeDeps.rollupOptions for rolldown-vite (#489)
1 parent 7690525 commit 4bec551

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

packages/plugin-react-swc/CHANGELOG.md

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

33
## Unreleased
44

5+
### Use `optimizeDeps.rollupOptions` instead of `optimizeDeps.esbuildOptions` for rolldown-vite [#489](https://github.com/vitejs/vite-plugin-react/pull/489)
6+
7+
This suppresses the warning about `optimizeDeps.esbuildOptions` being deprecated in rolldown-vite.
8+
59
## 3.10.1 (2025-06-03)
610

711
### Add explicit semicolon in preambleCode [#485](https://github.com/vitejs/vite-plugin-react/pull/485)

packages/plugin-react-swc/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
transform,
1313
} from '@swc/core'
1414
import type { PluginOption } from 'vite'
15+
import * as vite from 'vite'
1516
import {
1617
addRefreshWrapper,
1718
getPreambleCode,
@@ -124,7 +125,9 @@ const react = (_options?: Options): PluginOption[] => {
124125
oxc: false,
125126
optimizeDeps: {
126127
include: [`${options.jsxImportSource}/jsx-dev-runtime`],
127-
esbuildOptions: { jsx: 'automatic' },
128+
...('rolldownVersion' in vite
129+
? { rollupOptions: { jsx: { mode: 'automatic' } } }
130+
: { esbuildOptions: { jsx: 'automatic' } }),
128131
},
129132
}),
130133
configResolved(config) {

packages/plugin-react/CHANGELOG.md

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

33
## Unreleased
44

5+
### Use `optimizeDeps.rollupOptions` instead of `optimizeDeps.esbuildOptions` for rolldown-vite [#489](https://github.com/vitejs/vite-plugin-react/pull/489)
6+
7+
This suppresses the warning about `optimizeDeps.esbuildOptions` being deprecated in rolldown-vite.
8+
59
## 4.5.1 (2025-06-03)
610

711
### Add explicit semicolon in preambleCode [#485](https://github.com/vitejs/vite-plugin-react/pull/485)

packages/plugin-react/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
157157
jsx: 'automatic',
158158
jsxImportSource: opts.jsxImportSource,
159159
},
160-
optimizeDeps: { esbuildOptions: { jsx: 'automatic' } },
160+
optimizeDeps:
161+
'rolldownVersion' in vite
162+
? { rollupOptions: { jsx: { mode: 'automatic' } } }
163+
: { esbuildOptions: { jsx: 'automatic' } },
161164
}
162165
}
163166
},

0 commit comments

Comments
 (0)