Skip to content

Commit fffe4ad

Browse files
authored
feat: add support for rolldown-vite (#451)
1 parent ee45a93 commit fffe4ad

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

packages/plugin-react-swc/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Make compatible with rolldown-vite
6+
7+
This plugin is now compatible with rolldown-powered version of Vite.
8+
59
## 3.9.0-beta.3 (2025-04-15)
610

711
### Add `reactRefreshHost` option

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

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ const react = (_options?: Options): PluginOption[] => {
110110
apply: 'serve',
111111
config: () => ({
112112
esbuild: false,
113+
// NOTE: oxc option only exists in rolldown-vite
114+
oxc: false,
113115
optimizeDeps: {
114116
include: [`${options.jsxImportSource}/jsx-dev-runtime`],
115117
esbuildOptions: { jsx: 'automatic' },

packages/plugin-react/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
### Make compatible with rolldown-vite
6+
7+
This plugin is now compatible with rolldown-powered version of Vite.
8+
Note that currently the `__source` property value position might be incorrect. This will be fixed in the near future.
9+
510
## 4.4.0-beta.2 (2025-04-15)
611

712
### Add `reactRefreshHost` option

packages/plugin-react/src/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,14 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
203203
])
204204
}
205205

206-
if (opts.jsxRuntime === 'classic' && isJSX) {
206+
if (
207+
opts.jsxRuntime === 'classic' &&
208+
isJSX &&
209+
// OXC injects self and source so these plugins are not needed for rolldown-vite
210+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
211+
// @ts-ignore -- this.meta.rolldownVersion only exists in rolldown-vite
212+
!this.meta.rolldownVersion
213+
) {
207214
if (!isProduction) {
208215
// These development plugins are only needed for the classic runtime.
209216
plugins.push(

0 commit comments

Comments
 (0)