Releases: vitejs/vite-plugin-react
[email protected]
Fix type issue when using moduleResolution: "node"
in tsconfig #462
[email protected]
Make compatible with rolldown-vite
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.
[email protected]
Make compatible with rolldown-vite
This plugin is now compatible with rolldown-powered version of Vite.
[email protected]
Add reactRefreshHost
option
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 the host application URL in the Vite config of a remote application.
See full discussion here: module-federation/vite#183 (comment)
export default defineConfig({
plugins: [react({ reactRefreshHost: 'http://localhost:3000' })],
})
[email protected]
Add reactRefreshHost
option
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 the host application URL in the Vite config of a remote application.
See full discussion here: module-federation/vite#183 (comment)
export default defineConfig({
plugins: [react({ reactRefreshHost: 'http://localhost:3000' })],
})
[email protected]
[email protected]
[email protected]
[email protected]
Add Vite 6 to peerDependencies range
Vite 6 is highly backward compatible, not much to add!
Force Babel to output spec compliant import attributes #386
The default was an old spec (with type: "json"
). We now enforce spec compliant (with { type: "json" }
)
[email protected]
React Compiler runtimeModule option removed
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 } })],
}
})