NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1051 most downloaded on npm
The default Vite plugin for React projects
Last release 1 months ago
28 Aug 2026
Ships fairly regularly
a new release about every 4 weeks
Most releases are documented
notes for 46 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
88 releases · first in 2021
One column per quarter.
Recoverable React Compiler diagnostics are no longer logged by default. Set compiler.logDiagnostics to true to log them through Vite. Fatal diagnostic
compiler.logDiagnostics optionRecoverable 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.
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.
Add experimental native React Compiler support.
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 })
]
})
The improved filter in v6.0.3 was non-linear and caused a performance regression (#1349). The filter was changed to be linear to avoid that.
When running vite dev with NODE_ENV=production, the app errored with $RefreshSig$ is not defined. This error is now fixed.
$RefreshSig$ is not defined error when running vite dev with NODE_ENV=productionWhen running vite dev with NODE_ENV=production, the app errored with $RefreshSig$ is not defined.
This error is now fixed.
Improved the filter in the react compiler babel preset to reduce the false-positives so that less modules are processed by the react compiler.
Improved the filter in the react compiler babel preset to reduce the false-positives so that less modules are processed by the react compiler.
This is a type only change. Only compilationMode and target options were available for reactCompilerPreset.
This is a type only change. Only compilationMode and target options were available for reactCompilerPreset.
Expanded @rolldown/plugin-babel peer dep range to include ^0.2.0.
@rolldown/plugin-babel peer dep range (#1146)Expanded @rolldown/plugin-babel peer dep range to include ^0.2.0.
Nothing published for this version
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 red
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()]
+ }),
]
})
Vite 7 and below are no longer supported. If you are using Vite 7, please upgrade to Vite 8.
Nothing published for this version
When configuring babel.overrides without top-level plugins or presets, Babel was incorrectly skipped. The canSkipBabel function now checks for overrid
canSkipBabel not accounting for babel.overrides (#1098)When configuring babel.overrides without top-level plugins or presets, Babel was incorrectly skipped. The canSkipBabel function now checks for overrides.length to ensure override configurations are processed.
Nothing published for this version
Nothing published for this version
rolldown-vite will remove optimizeDeps.rollupOptions in favor of optimizeDeps.rolldownOptions soon. This plugin now uses optimizeDeps.rolldownOptions
rolldown-vite (#976)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.
SSR applications can now initialize HMR runtime by importing @vitejs/plugin-react/preamble at the top of their client entry instead of manually callin
@vitejs/plugin-react/preamble virtual module for SSR HMR (#890)SSR applications can now initialize HMR runtime by importing @vitejs/plugin-react/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.
Rolldown 1.0.0-beta.44+ removed the top-level jsx option in favor of transform.jsx. This plugin now uses the transform.jsx option to support Rolldown 1.0.0-beta.44+.
### Perf: use native refresh wrapper plugin in rolldown-vite
### HMR did not work for components imported with queries with rolldown-vite (#872) ### Perf: simplify refresh wrapper generation
### Skip transform hook completely in rolldown-vite in dev if possible
optimizeDeps.rollupOptions.jsx is going to be deprecated in favor of optimizeDeps.rollupOptions.transform.jsx.
optimizeDeps.rollupOptions.transform.jsx instead of optimizeDeps.rollupOptions.jsx for rolldown-vite (#735)optimizeDeps.rollupOptions.jsx is going to be deprecated in favor of optimizeDeps.rollupOptions.transform.jsx.
babel-plugin-react-compiler if code has no "use memo" when { compilationMode: "annotation" } (#734)jsxImportSource (#726)reactRefreshHost option on rolldown-vite (#716)RefreshRuntime being injected twice for class components on rolldown-vite (#708)babel-plugin-react-compiler on non client environment (689)Nothing published for this version
Since this behavior is what @vitejs/plugin-react-oxc did, @vitejs/plugin-react-oxc is now deprecated and the disableOxcRecommendation option is remove…
When used with rolldown-vite, this plugin now uses Oxc for react refresh transform.
Since this behavior is what @vitejs/plugin-react-oxc did, @vitejs/plugin-react-oxc is now deprecated and the disableOxcRecommendation option is removed.
Also, while @vitejs/plugin-react-oxc used the production JSX transform even for NODE_ENV=development build, @vitejs/plugin-react uses the development JSX transform for NODE_ENV=development build.
node_modulesThe default value of exclude options is now [/\/node_modules\//] to allow processing files in node_modules directory. It was previously [] and files in node_modules was always excluded regardless of the value of exclude option.
react and react-dom is no longer added to resolve.dedupe automaticallyAdding values to resolve.dedupe forces Vite to resolve them differently from how Node.js does, which can be confusing and may not be expected. This plugin no longer adds react and react-dom to resolve.dedupe automatically.
If you encounter errors after upgrading, check your package.json for version mismatches in dependencies or devDependencies, as well as your package manager’s configuration. If you prefer the previous behavior, you can manually add react and react-dom to resolve.dedupe.
babel-plugin-react-compiler support that requires runtimeModule optionruntimeModule option is no longer needed in newer babel-plugin-react-compiler versions. Make sure to use a newer version of babel-plugin-react-compiler that supports target option.
This plugin now requires Node 20.19+ or 22.12+.
HMR now works for compound components like this:
HMR now works for compound components like this:
const Root = () => <div>Accordion Root</div>
const Item = () => <div>Accordion Item</div>
export const Accordion = { Root, Item }
Plugin[] instead of PluginOption[] (#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:
// previously this causes type errors
react({ babel: { plugins: ['babel-plugin-react-compiler'] } })
.map(p => ({ ...p, applyToEnvironment: e => e.name === 'client' }))
This plugin only worked with Vite. But now it can also be used with raw Rolldown. The main purpose for using this plugin with Rolldown is to use react
This plugin only worked with Vite. But now it can also be used with raw Rolldown. The main purpose for using this plugin with Rolldown is to use react compiler.
This suppresses the warning about optimizeDeps.esbuildOptions being deprecated in rolldown-vite.
@vitejs/plugin-react-oxc if rolldown-vite is detected #491Emit 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.
optimizeDeps.rollupOptions instead of optimizeDeps.esbuildOptions for rolldown-vite #489This suppresses the warning about optimizeDeps.esbuildOptions being deprecated in rolldown-vite.
React plugins are compatible with Vite 7, this removes the warning when testing the beta.
This fixes an edge case when using HTML minifiers that strips line breaks aggressively.
This fixes an edge case when using HTML minifiers that strips line breaks aggressively.
Added filter so that it is more performant when running this plugin with rolldown-powered version of Vite.
Fix type issue when using moduleResolution: "node" in tsconfig #462
Fix type issue when using moduleResolution: "node" in tsconfig #462
This plugin is now compatible with rolldown-powered version of Vite. Note that currently the __source property value position might be incorrect. This
This plugin is now compatible with rolldown-powered version of Vite.
Note that currently the __source property value position might be incorrect. This will be fixed in the near future.
Add reactRefreshHost option to set a React Fast Refresh runtime URL prefix. This is useful in a module federation context to enable HMR by specifying
reactRefreshHost optionAdd reactRefreshHost option to set a React Fast Refresh runtime URL prefix.
This is useful in a module federation context to enable HMR by specifying the host application URL in the Vite config of a remote application.
See full discussion here: https://github.com/module-federation/vite/issues/183#issuecomment-2751825367
export default defineConfig({
plugins: [react({ reactRefreshHost: 'http://localhost:3000' })],
})
This project publishes no release notes. Between v4.3.4 and v4.4.0-beta.1 there were 238 commits, 193 of them substantive:
This project publishes no release notes. Between v4.3.4 and v4.4.0-beta.1 there were 238 commits, 193 of them substantive:
@swc/core to get new features [publish]react/jsx-dev-runtime for dependencies optimisation when using automatic runtime [publish]…and 173 more.
Vite 6 is highly backward compatible, not much to add!
Vite 6 is highly backward compatible, not much to add!
The default was an old spec (with type: "json"). We now enforce spec compliant (with { type: "json" })
This project publishes no release notes. Between v4.3.3 and v4.3.4 there were 5 commits, 4 of them substantive:
React Compiler was updated to accept a target option and runtimeModule was removed. vite-plugin-react will still detect runtimeModule for backwards co
React Compiler was updated to accept a target option and runtimeModule was removed. vite-plugin-react will still detect runtimeModule for backwards compatibility.
When using a custom runtimeModule or target !== '19', the plugin will not try to pre-optimize react/compiler-runtime dependency.
The react-compiler-runtime is now available on npm can be used instead of the local shim for people using the compiler with React < 19.
Here is the configuration to use the compiler with React 18 and correct source maps in development:
npm install babel-plugin-react-compiler react-compiler-runtime @babel/plugin-transform-react-jsx-development
export default defineConfig(({ command }) => {
const babelPlugins = [['babel-plugin-react-compiler', { target: '18' }]]
if (command === 'serve') {
babelPlugins.push(['@babel/plugin-transform-react-jsx-development', {}])
}
return {
plugins: [react({ babel: { plugins: babelPlugins } })],
}
})
This project publishes no release notes. Between v4.3.2 and v4.3.3 there were 3 commits, 3 of them substantive:
react-dom in optimizeOps to handle CJS script. (#375)Ignore directive sourcemap error #369
Ignore directive sourcemap error #369
This project publishes no release notes. Between v4.3.1 and v4.3.2 there were 6 commits, 5 of them substantive:
The previous version made this assumption that the compiler was only usable with React 19, but it's possible to use it with React 18 and a custom runt
The previous version made this assumption that the compiler was only usable with React 19, but it's possible to use it with React 18 and a custom runtimeModule: https://gist.github.com/poteto/37c076bf112a07ba39d0e5f0645fec43
When using a custom runtimeModule, the plugin will not try to pre-optimize react/compiler-runtime dependency.
Reminder: Vite expect code outside of node_modules to be ESM, so you will need to update the gist with import React from 'react'.
This project publishes no release notes. Between v4.3.0 and v4.3.1 there were 4 commits, 4 of them substantive:
Don't set retainLines: true when the React compiler is used. This creates whitespace issues and the compiler is modifying the JSX too much to get corr
Don't set retainLines: true when the React compiler is used. This creates whitespace issues and the compiler is modifying the JSX too much to get correct line numbers after that. If you want to use the React compiler and get back correct line numbers for tools like vite-plugin-react-click-to-component to work, you should update your config to something like:
export default defineConfig(({ command }) => {
const babelPlugins = [['babel-plugin-react-compiler', {}]]
if (command === 'serve') {
babelPlugins.push(['@babel/plugin-transform-react-jsx-development', {}])
}
return {
plugins: [react({ babel: { plugins: babelPlugins } })],
}
})
This is a long overdue and should fix some issues people had with HMR when migrating from CRA.
This project publishes no release notes. Between v4.2.1 and v4.3.0 there were 10 commits, 5 of them substantive:
context from render (#276)Remove generic parameter on Plugin to avoid type error with Rollup 4/Vite 5 and skipLibCheck: false.
Remove generic parameter on Plugin to avoid type error with Rollup 4/Vite 5 and skipLibCheck: false.
I expect very few people to currently use this feature, but if you are extending the React plugin via api object, you can get back the typing of the hook by importing ViteReactPluginApi:
import type { Plugin } from 'vite'
import type { ViteReactPluginApi } from '@vitejs/plugin-react'
export const somePlugin: Plugin = {
name: 'some-plugin',
api: {
reactBabel: (babelConfig) => {
babelConfig.plugins.push('some-babel-plugin')
},
} satisfies ViteReactPluginApi,
}
This project publishes no release notes. Between v4.2.0 and v4.2.1 there were 7 commits, 3 of them substantive:
There were no breaking change that impacted this plugin, so any combination of React plugins and Vite core version will work.
There were no breaking change that impacted this plugin, so any combination of React plugins and Vite core version will work.
This will only affect people using internal libraries that contains untranspiled JSX. This change aligns the optimizer with the source code and avoid issues when the published source don't have React in the scope.
Reminder: While being partially supported in Vite, publishing TS & JSX outside of internal libraries is highly discouraged.
This project publishes no release notes. Between v4.1.1 and v4.2.0 there were 9 commits, 6 of them substantive:
Enable retainLines to get correct line numbers for jsxDev (fix #235)
This project publishes no release notes. Between v4.1.0 and v4.1.1 there were 11 commits, 5 of them substantive:
Add @types/babel__cores to dependencies (fix #211)
@types/babel__cores to dependencies (fix #211)@babel/core #212index.d.cts file so you don't get types errors when setting moduleResolution to node16 or nodenext in your tsconfig (we recommend using bundler which is more close to how Vite works)Fix #198: Enable Babel if presets list is not empty
Revert #108: Remove throw when refresh runtime is loaded twice to enable usage in micro frontend apps. This was added to help fix setup usage, and thi
Fix fast-refresh for files that are transformed into jsx
Support Vitest deps.experimentalOptimizer
This major version include a revamp of options:
This major version include a revamp of options:
include/exclude now allow to completely override the files processed by the plugin (#122). This is more in line with other Rollup/Vite plugins and simplify the setup of enabling Fast Refresh for .mdx files. This can be done like this:export default defineConfig({
plugins: [
{ enforce: 'pre', ...mdx() },
react({ include: /\.(mdx|js|jsx|ts|tsx)$/ }),
],
})
These changes also allow to apply Babel plugins on files outside Vite root (expect in node_modules), which improve support for monorepo (fix #16).
With these changes, only the file extensions is used for filtering processed files and the query param fallback is removed.
fastRefresh is removed (#122). This should be correctly activated by plugin without configuration.jsxPure is removed. This is a niche use case that was just passing down the boolean to esbuild.jsxSideEffects. (#129)The support for React auto import whe using classic runtime is removed. This was prone to errors and added complexity for no good reason given the very wide support of automatic runtime nowadays. This migration path should be as simple as removing the runtime option from the config.
This release goes in hand with the upcoming Vite 4.3 release focusing on performances:
Other notable changes:
fix: add jsx dev runtime to optimizeDeps (#147) (3bbd8f0), closes #147
jsxRuntime is unchanged but deprecated (#131) and will be removed in the next major.
This major version include a revamp of options:
include/exclude now allow to completely override the files processed by the plugin (#122). This is more in line with other Rollup/Vite plugins and simplify the setup of enabling Fast Refresh for .mdx files. This can be done like this:export default defineConfig({
plugins: [
{ enforce: 'pre', ...mdx() },
react({ include: /\.(mdx|js|jsx|ts|tsx)$/ }),
],
})
These changes also allow to apply Babel plugins on files outside Vite root (expect in node_modules), which improve support for monorepo (fix #16).
With these changes, only the file extensions is used for filtering processed files and the query param fallback is removed.
fastRefresh is removed (#122). This should be correctly activated by plugin without configuration.jsxPure is removed. This is a niche use case that was just passing down the boolean to esbuild.jsxSideEffects. (#129)jsxRuntime is unchanged but deprecated (#131) and will be removed in the next major.This release goes in hand with the upcoming Vite 4.3 release focusing on performances:
Other notable changes:
doc: add jsxImportSource option
fix: add RefreshSig to refresh content regex (closes #52) (c8dd1d6), closes #52
Nothing published for this version
chore: clean some leftovers from Vite core (#44) (d2a3931), closes #44
fix(deps): update all non-major dependencies (#11091) (073a4bf), closes #11091
fix(plugin-react): jsxDev is not a function when is set NODE_ENV in env files (#10861) (be1ba4a), closes #10861
feat!: transform jsx with esbuild instead of babel (#9590) (f677b62), closes #9590
fix(deps): update all non-major dependencies (#10610) (bb95467), closes #10610
fix(deps): update all non-major dependencies (#10077) (caf00c8), closes #10077
throwIfNamespace option for custom JSX runtime (#9571) (f842f74), closes #9571fix(plugin-react): duplicate self prop and source prop (#9387) (c89de3a), closes #9387
Nothing published for this version
chore: 3.0 release notes and bump peer deps (#9072) (427ba26), closes #9072
Your coding agent can read these notes before it upgrades. Set up the MCP server →