Skip to content

Commit db1c665

Browse files
authored
fix(react): newer full bundle mode compat (#1011)
1 parent 1f372b6 commit db1c665

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/plugin-react/src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default function viteReact(opts: Options = {}): Plugin[] {
119119
let projectRoot = process.cwd()
120120
let skipFastRefresh = true
121121
let base: string
122-
let isFullBundle = false
122+
let isBundledDev = false
123123
let runPluginOverrides:
124124
| ((options: ReactBabelOptions, context: ReactBabelHookContext) => void)
125125
| undefined
@@ -191,8 +191,8 @@ export default function viteReact(opts: Options = {}): Plugin[] {
191191
base = config.base
192192
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- use ts-ignore for ecosystem-ci
193193
// @ts-ignore only available in newer rolldown-vite
194-
if (config.experimental.fullBundleMode) {
195-
isFullBundle = true
194+
if (config.experimental.bundledDev) {
195+
isBundledDev = true
196196
}
197197
projectRoot = config.root
198198
isProduction = config.isProduction
@@ -450,12 +450,12 @@ export default function viteReact(opts: Options = {}): Plugin[] {
450450
}
451451

452452
// for rolldown-vite + full bundle mode
453-
const viteReactRefreshFullBundleMode: Plugin = {
453+
const viteReactRefreshBundledDevMode: Plugin = {
454454
name: 'vite:react-refresh-fbm',
455455
enforce: 'pre',
456456
transformIndexHtml: {
457457
handler() {
458-
if (!skipFastRefresh && isFullBundle)
458+
if (!skipFastRefresh && isBundledDev)
459459
return [
460460
{
461461
tag: 'script',
@@ -514,7 +514,7 @@ export default function viteReact(opts: Options = {}): Plugin[] {
514514
},
515515
},
516516
transformIndexHtml() {
517-
if (!skipFastRefresh && !isFullBundle)
517+
if (!skipFastRefresh && !isBundledDev)
518518
return [
519519
{
520520
tag: 'script',
@@ -528,12 +528,12 @@ export default function viteReact(opts: Options = {}): Plugin[] {
528528
return [
529529
viteBabel,
530530
...(isRolldownVite
531-
? [viteRefreshWrapper, viteConfigPost, viteReactRefreshFullBundleMode]
531+
? [viteRefreshWrapper, viteConfigPost, viteReactRefreshBundledDevMode]
532532
: []),
533533
viteReactRefresh,
534534
virtualPreamblePlugin({
535535
name: '@vitejs/plugin-react/preamble',
536-
isEnabled: () => !skipFastRefresh && !isFullBundle,
536+
isEnabled: () => !skipFastRefresh && !isBundledDev,
537537
}),
538538
]
539539
}

0 commit comments

Comments
 (0)