plugin-react@6.0.0-beta.0
Pre-release
Pre-release
·
1 commit
to main
since this release
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.