Skip to content

Commit 22079fa

Browse files
authored
fix(plugin-react): fix new refreshInclude option (#1543)
1 parent d0f7234 commit 22079fa

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎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+
### Fix `refreshInclude` and `refreshExclude` options not working ([#1543](https://github.com/vitejs/vite-plugin-react/pull/1543))
6+
7+
Fix mistake from #1516
8+
59
## 6.2.0 (2026-11-02)
610

711
### Add `refreshInclude` and `refreshExclude` options ([#1516](https://github.com/vitejs/vite-plugin-react/pull/1516))

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,19 +375,17 @@ function createReactCompilerPlugin(
375375
},
376376
},
377377
async handler(code, id) {
378-
// Follow what the builtin oxc plugin does: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/oxc.ts#L250-L267
379378
const [filepath] = id.split('?')
380379
const isJSX = filepath.endsWith('x')
381380
const isClient = this.environment?.config.consumer !== 'server'
382381
const refreshEnabled =
383382
isClient &&
384383
isFastRefreshEnabled() &&
385-
((jsxRefreshFilter && !jsxRefreshFilter(id)) ||
386-
!(
387-
isJSX ||
384+
(jsxRefreshFilter
385+
? jsxRefreshFilter(id)
386+
: isJSX ||
388387
code.includes(jsxImportRuntime) ||
389-
code.includes(jsxImportDevRuntime)
390-
))
388+
code.includes(jsxImportDevRuntime))
391389

392390
const shouldCompile =
393391
isClient &&

0 commit comments

Comments
 (0)