chore: bump up @vitejs/plugin-react-swc version to v4 (#14405)
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
|
[@vitejs/plugin-react-swc](https://redirect.github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc#readme)
([source](https://redirect.github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react-swc))
| [`^3.7.2` →
`^4.0.0`](https://renovatebot.com/diffs/npm/@vitejs%2fplugin-react-swc/3.9.0/4.2.3)
|

|

|
---
### Release Notes
<details>
<summary>vitejs/vite-plugin-react
(@​vitejs/plugin-react-swc)</summary>
###
[`v4.2.3`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#423-2026-02-02)
[Compare
Source](5e600a31ec...12914fa8c1)
###
[`v4.2.2`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#422-2025-11-12)
[Compare
Source](https://redirect.github.com/vitejs/vite-plugin-react/compare/v4.2.1...5e600a31ec27fae54df58a46ef1fffa80238042e)
##### Update code to support newer `rolldown-vite`
([#​978](https://redirect.github.com/vitejs/vite-plugin-react/pull/978))
`rolldown-vite` will remove `optimizeDeps.rollupOptions` in favor of
`optimizeDeps.rolldownOptions` soon. This plugin now uses
`optimizeDeps.rolldownOptions` to support newer `rolldown-vite`. Please
update `rolldown-vite` to the latest version if you are using an older
version.
###
[`v4.2.1`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#421-2025-11-05)
[Compare
Source](https://redirect.github.com/vitejs/vite-plugin-react/compare/v4.2.0...v4.2.1)
##### Fix `@vitejs/plugin-react-swc/preamble` on build
([#​962](https://redirect.github.com/vitejs/vite-plugin-react/pull/962))
###
[`v4.2.0`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#420-2025-10-24)
[Compare
Source](https://redirect.github.com/vitejs/vite-plugin-react/compare/v4.1.0...v4.2.0)
##### Add `@vitejs/plugin-react-swc/preamble` virtual module for SSR HMR
([#​890](https://redirect.github.com/vitejs/vite-plugin-react/pull/890))
SSR applications can now initialize HMR runtime by importing
`@vitejs/plugin-react-swc/preamble` at the top of their client entry
instead of manually calling `transformIndexHtml`. This simplifies SSR
setup for applications that don't use the `transformIndexHtml` API.
##### Use SWC when useAtYourOwnRisk\_mutateSwcOptions is provided
([#​951](https://redirect.github.com/vitejs/vite-plugin-react/pull/951))
Previously, this plugin did not use SWC if plugins were not provided
even if `useAtYourOwnRisk_mutateSwcOptions` was provided. This is now
fixed.
###
[`v4.1.0`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#410-2025-09-17)
[Compare
Source](f21864b102...v4.1.0)
##### Set SWC cacheRoot options
This is set to `{viteCacheDir}/swc` and override the default of `.swc`.
##### Perf: simplify refresh wrapper generation
([#​835](https://redirect.github.com/vitejs/vite-plugin-react/pull/835))
###
[`v4.0.1`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#401-2025-08-19)
[Compare
Source](590f394c1e...f21864b102d40fca4f70dfe9112a10101ec12f54)
##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of
`optimizeDeps.rollupOptions.jsx` for rolldown-vite
([#​735](https://redirect.github.com/vitejs/vite-plugin-react/pull/735))
`optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of
`optimizeDeps.rollupOptions.transform.jsx`.
###
[`v4.0.0`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#400-2025-08-07)
[Compare
Source](9e0c103895...590f394c1e451987258ed64a4b5fb6207c5e8261)
###
[`v3.11.0`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#3110-2025-07-18)
[Compare
Source](32d49ecf9b...9e0c1038959e828865be810a164a51c3db1ac375)
##### Add HMR support for compound components
([#​518](https://redirect.github.com/vitejs/vite-plugin-react/pull/518))
HMR now works for compound components like this:
```tsx
const Root = () => <div>Accordion Root</div>
const Item = () => <div>Accordion Item</div>
export const Accordion = { Root, Item }
```
##### Return `Plugin[]` instead of `PluginOption[]`
([#​537](https://redirect.github.com/vitejs/vite-plugin-react/pull/537))
The return type has changed from `react(): PluginOption[]` to more
specialized type `react(): Plugin[]`. This allows for type-safe
manipulation of plugins, for example:
```tsx
// previously this causes type errors
react()
.map(p => ({ ...p, applyToEnvironment: e => e.name === 'client' }))
```
###
[`v3.10.2`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#3102-2025-06-10)
[Compare
Source](8ce7183265...32d49ecf9b15e3070c7abe5a176252a3fe542e5c)
##### Suggest `@vitejs/plugin-react-oxc` if rolldown-vite is detected
[#​491](https://redirect.github.com/vitejs/vite-plugin-react/pull/491)
Emit a log which recommends `@vitejs/plugin-react-oxc` when
`rolldown-vite` is detected to improve performance and use Oxc under the
hood. The warning can be disabled by setting `disableOxcRecommendation:
true` in the plugin options.
##### Use `optimizeDeps.rollupOptions` instead of
`optimizeDeps.esbuildOptions` for rolldown-vite
[#​489](https://redirect.github.com/vitejs/vite-plugin-react/pull/489)
This suppresses the warning about `optimizeDeps.esbuildOptions` being
deprecated in rolldown-vite.
##### Add Vite 7-beta to peerDependencies range
[#​497](https://redirect.github.com/vitejs/vite-plugin-react/pull/497)
React plugins are compatible with Vite 7, this removes the warning when
testing the beta.
###
[`v3.10.1`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#3101-2025-06-03)
[Compare
Source](dcadcfc284...8ce7183265c43f88623655a9cfdcec5282068f9b)
##### Add explicit semicolon in preambleCode
[#​485](https://redirect.github.com/vitejs/vite-plugin-react/pull/485)
This fixes an edge case when using HTML minifiers that strips line
breaks aggressively.
###
[`v3.10.0`](https://redirect.github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react-swc/CHANGELOG.md#3100-2025-05-23)
[Compare
Source](4a944487aa...dcadcfc2841c0bedfe44279c556835c350dfa5fa)
##### Add `filter` for rolldown-vite
[#​470](https://redirect.github.com/vitejs/vite-plugin-react/pull/470)
Added `filter` so that it is more performant when running this plugin
with rolldown-powered version of Vite.
##### Skip HMR preamble in Vitest browser mode
[#​478](https://redirect.github.com/vitejs/vite-plugin-react/pull/478)
This was causing annoying `Sourcemap for "/@​react-refresh" points
to missing source files` and is unnecessary in test mode.
##### Skip HMR for JSX files with hooks
[#​480](https://redirect.github.com/vitejs/vite-plugin-react/pull/480)
This removes the HMR warning for hooks with JSX.
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45NS4yIiwidXBkYXRlZEluVmVyIjoiNDIuOTUuMiIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>