What changed in @vitejs/plugin-react from 5 to 6
8 releases numbered after 5.2.0 up to and including 6.1.1, stable releases only. 5.2.0 and 6.1.1 are the newest stable releases of 5 and 6 we track; this page follows them as new ones ship.
- 1 removes or deprecates something
11 changes across 8 releases
- React Compiler transform now respects environment sourcemap option instead of top-level sourcemap option when `builder.sharedPlugins` is enabled
- React compiler preset filter to be linear to avoid performance regression
- Fix $RefreshSig$ is not defined error when running vite dev with NODE_ENV=production
- Babel is no longer a dependency and Babel-related configuration options are removed
- Support for Vite 7 and below
One release in the range carries no categorized changes yet: 6.0.3. Their original notes, where the vendor published any, are below.
Original release notes, newest first
The list above is our reading of these notes; the originals from Vite are here, one fold per release.
6.1.1
Add compiler.logDiagnostics option
Recoverable React Compiler diagnostics are no longer logged by default. Set compiler.logDiagnostics to true to log them through Vite. Fatal diagnostics are always logged and fail the transform.
Respect environment sourcemap option for React Compiler transform when builder.sharedPlugins is enabled (#1439)
The React Compiler transform was using the top-level sourcemap option instead of the environment sourcemap option. This caused a problem when the experimental builder.sharedPlugins was enabled.
6.1.0
Add experimental native React Compiler support (#1419)
Add experimental native React Compiler support.
You can use it by installing oxc-transform-react and enabling it via the compiler option:
npm install -D oxc-transform-react
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [
react({ compiler: true })
]
})
6.0.5
6.0.4
Fixed $RefreshSig$ is not defined error when running vite dev with NODE_ENV=production
When running vite dev with NODE_ENV=production, the app errored with $RefreshSig$ is not defined.
This error is now fixed.
6.0.3
The vendor published no notes for this release.
6.0.2
Allow all options in reactCompilerPreset (#1189)
This is a type only change. Only compilationMode and target options were available for reactCompilerPreset.
6.0.1
Expand @rolldown/plugin-babel peer dep range (#1146)
Expanded @rolldown/plugin-babel peer dep range to include ^0.2.0.
6.0.0
Remove Babel Related Features (#1123)
Vite 8+ can handle React Refresh Transform by Oxc and doesn't need Babel for it. With that, there are no transform applied that requires Babel. To reduce the installation size of this plugin, babel is no longer a dependency of this plugin and the related features are removed.
If you are using Babel, you can use @rolldown/plugin-babel together with this plugin:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
+import babel from '@rolldown/plugin-babel'
export default defineConfig({
plugins: [
- react({
- babel: {
- plugins: ['@babel/plugin-proposal-throw-expressions'],
- },
- }),
+ react(),
+ babel({
+ plugins: ['@babel/plugin-proposal-throw-expressions'],
+ }),
]
})
For React compiler users, you can use reactCompilerPreset for easier setup with preconfigured filter to improve build performance:
import { defineConfig } from 'vite'
-import react from '@vitejs/plugin-react'
+import react, { reactCompilerPreset } from '@vitejs/plugin-react'
+import babel from '@rolldown/plugin-babel'
export default defineConfig({
plugins: [
- react({
- babel: {
- plugins: ['babel-plugin-react-compiler'],
- },
- }),
+ react(),
+ babel({
+ presets: [reactCompilerPreset()]
+ }),
]
})
Drop Vite 7 and below support (#1124)
Vite 7 and below are no longer supported. If you are using Vite 7, please upgrade to Vite 8.