Skip to content

docs: document Oxc React Compiler and Babel migration - #14522

Open
hanford wants to merge 2 commits into
withastro:mainfrom
hanford:docs/react-oxc-compiler
Open

docs: document Oxc React Compiler and Babel migration#14522
hanford wants to merge 2 commits into
withastro:mainfrom
hanford:docs/react-oxc-compiler

Conversation

@hanford

@hanford hanford commented Sep 9, 2026

Copy link
Copy Markdown

Description (required)

Documents the React integration's major migration to @vitejs/plugin-react v6 and Oxc. The babel integration option is removed; users with custom Babel transforms must install @rolldown/plugin-babel and @babel/core and configure them under vite.plugins.

Adds before-and-after configuration examples, package-manager installation tabs, and guidance for passing Babel options directly and handling conditional transforms. Explains that this setup runs Babel before Oxc transforms TypeScript and JSX, including when compiler: true is enabled.

The compiler section covers installation, opt-in setup, React 17/18 runtime dependencies, compiler options, and exclusions. Links to the Babel migration section and removes the claim that existing Babel configuration remains compatible.

The release version marker can be added once the implementation release version is assigned.

Validation: Prettier and git diff --check passed; pnpm check reported 0 errors, 0 warnings, and one existing hint. Verified the migration section and configuration examples render locally. The implementation PR includes a TSX regression proving custom Babel transforms run before type stripping in development and production, with the compiler enabled and disabled.

References

@astrobot-houston

astrobot-houston commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/integrations-guide/react.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@astrobot-houston

Copy link
Copy Markdown
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🥳.

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@hanford
hanford marked this pull request as ready for review September 9, 2026 16:29
@hanford hanford changed the title docs: document the React Compiler option docs: document Oxc React Compiler and Babel migration Sep 10, 2026
});
```

This also works with `react({ compiler: true })`. Babel runs before Oxc transforms TypeScript and JSX. The Babel plugin automatically enables parsing for `.jsx`, `.ts`, and `.tsx` files. It does not load `babel.config.js` or `.babelrc` files; pass the options directly to `babel()`. The old `babel` callback is not supported; use the plugin's [`overrides` and preset hooks](https://github.com/rolldown/plugins/tree/main/packages/babel#options) for conditional transforms.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we have to over-explain how the babel plugin works, people can refer to its docs about that.

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.

3 participants