Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/plugin-react-swc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
transform,
} from '@swc/core'
import type { PluginOption } from 'vite'
import * as vite from 'vite'
import {
addRefreshWrapper,
getPreambleCode,
Expand Down Expand Up @@ -124,7 +125,9 @@ const react = (_options?: Options): PluginOption[] => {
oxc: false,
optimizeDeps: {
include: [`${options.jsxImportSource}/jsx-dev-runtime`],
esbuildOptions: { jsx: 'automatic' },
...('rolldownVersion' in vite
? { rollupOptions: { jsx: { mode: 'automatic' } } }
: { esbuildOptions: { jsx: 'automatic' } }),
},
}),
configResolved(config) {
Expand Down
5 changes: 4 additions & 1 deletion packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
jsx: 'automatic',
jsxImportSource: opts.jsxImportSource,
},
optimizeDeps: { esbuildOptions: { jsx: 'automatic' } },
optimizeDeps:
'rolldownVersion' in vite
? { rollupOptions: { jsx: { mode: 'automatic' } } }
: { esbuildOptions: { jsx: 'automatic' } },
}
}
},
Expand Down
Loading