Update code to support newer rolldown-vite (#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.
Perf: simplify refresh wrapper generation (#835)
Set optimizeDeps.rollupOptions.transform.jsx instead of optimizeDeps.rollupOptions.jsx (#735)
optimizeDeps.rollupOptions.jsx is going to be deprecated in favor of optimizeDeps.rollupOptions.transform.jsx.
The changes of this plugin is now included in @vitejs/plugin-react. Please use @vitejs/plugin-react instead.
The 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.
This plugin now requires Node 20.19+ or 22.12+.
Add HMR support for compound components (#518)
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 }Return 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()
.map(p => ({ ...p, applyToEnvironment: e => e.name === 'client' }))Disable refresh transform when server.hmr: false is set #502
This fixes "$RefreshReg$ is not defined" error when running Vitest with the plugin.
Add Vite 7-beta to peerDependencies range #497
React plugins are compatible with Vite 7, this removes the warning when testing the beta.
Add explicit semicolon in preambleCode #485
This fixes an edge case when using HTML minifiers that strips line breaks aggressively.
Add filter for rolldown-vite #470
Added filter so that it is more performant when running this plugin with rolldown-powered version of Vite.
Skip HMR for JSX files with hooks #480
This removes the HMR warning for hooks with JSX.
- Create Oxc plugin