@vitejs/plugin-react
6.3.0 · 9 Nov 2026MIT142M / weekRepositoryHomepagenpmAtom feed
4.7.0 is the newest release of 4.x.
In short
3 breaking3 removed2 new2 faster3 fixed
- Breaking
These options 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
.mdxfiles. This can be done like this: - Breaking
Vite 4.2 is required as a peer dependency
- Breaking
Throw when refresh runtime is loaded twice
- Removed
With these changes, only the file extensions is used for filtering processed files and the query param fallback is removed.
- Removed
The support for React auto import when 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.
- Removed
jsxPure(#129) This is a niche use case that was just passing down the boolean toesbuild.jsxSideEffects.
Release note
Options changes
include/exclude
These options 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.
jsxRuntime
The support for React auto import when 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.
Removed options
- Removed
fastRefresh(#122) This should be correctly activated by plugin without configuration. - Removed
jsxPure(#129) This is a niche use case that was just passing down the boolean toesbuild.jsxSideEffects.
Perf
This release goes in hand with the upcoming Vite 4.3 release focusing on performances:
Cache plugin load
Wrap dynamic import to speedup analysis
Other notable changes
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.