Skip to content

feat(react)!: remove babel#1123

Draft
sapphi-red wants to merge 5 commits intorefactor/react-drop-vite7-and-below-supportfrom
feat/react-remove-babel
Draft

feat(react)!: remove babel#1123
sapphi-red wants to merge 5 commits intorefactor/react-drop-vite7-and-below-supportfrom
feat/react-remove-babel

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Feb 27, 2026

Description

Built on top of #1124

In Vite 8 (currently beta), react refresh transform can be handled by Oxc. This means there's no transform that uses babel by default.
To reduce the install size, I think we should remove babel from the dependency of @vitejs/plugin-react.

The @rolldown/plugin-babel package lives at https://github.com/rolldown/plugins.

context: #1114

@sapphi-red sapphi-red force-pushed the feat/react-remove-babel branch from 7a9ebf1 to a20730e Compare February 27, 2026 08:40
@sapphi-red sapphi-red changed the base branch from main to refactor/react-drop-vite7-and-below-support February 27, 2026 08:40
Copy link
Member

@ArnaudBarre ArnaudBarre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool, thanks for the cleanup, I'm happy I will be able stop downloading babel!
We need to updates the docs (both Readmes in the repo and vite.dev)
I think we should also add a section on how to add babel to a Vite 8 project, promoting this new plugin and all the possibilities for filtering.

export default defineConfig({
plugins: [
react({
exclude: [/\/node_modules\/(?!(\.pnpm\/)?test-package)/],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is need given the current test.
We are now testing the capability of @rolldown/plugin-babel to include node_modules.
Maybe the package could contain JSX to show that we can force OXC to run on node_modules files?

function viteReactForCjs(this: unknown, options: Options): Plugin[] {
return viteReact.call(this, options)
}
Object.assign(viteReactForCjs, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this needed when supporting only Vite 8+ which means require(esm) IIRM?

},
"devDependencies": {
"@babel/core": "^7.29.0",
"@babel/plugin-transform-react-jsx-development": "^7.27.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this plugin needed? It's not here in multiple playground
Is it injected by @rolldown/plugin-babel ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants