docs: document Oxc React Compiler and Babel migration - #14522
Conversation
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
|
Preview deployment ✅ Deployment complete!
|
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Thank you, @hanford! I left some suggestions because:
- we need a
<Since />to callout this is new and not available for everyone - it might be helpful to start with what is the default behavior to explain when/why users might want to enable this feature. I'm not sure everyone knows what the React compiler does and that this is something obvious to them.
- the "Migrating..." section is misplaced: this is not an integration option
- as Matthew said, I think we're giving too much details about Babel. Our job is only to document how Astro works.
- I felt that some sentences were misplaced or not connected to the next sentence in the paragraph. So, I reorganized or rewrote a few passages.
Feel free to check if what I wrote is still accurate! This is your feature, you know it better than me.
Also, and maybe @matthewp as an opinion on this:
I was wondering why this is experimental... Experimental features are usually prefixed with experimental (e.g. experimentalReactChildren, experimentalDisableStreaming) and that's not the case here. I can see now that it's actually experimental upstream.
I don't know/recall how we deal with experimental features when they are upstream... But, I wonder if this lack of consistency might confuse users (as I was) and if this option shouldn't be named experimentalCompiler rather than compiler.
I guess experimentalCompiler is annoying because we would need another major when this becomes stable upstream? But I prefer to highlight the inconsistency here.
|
Thanks @ArmandPhilippot! I’ve incorporated your suggestions and checked the technical details. The docs now include the block, explain the default behavior and compiler benefits, and move migration into a separate v7 upgrade section with shorter Babel guidance. On naming, I lean toward keeping |
Description (required)
Documents the experimental Oxc React Compiler option introduced in
@astrojs/reactv7.0.0, including its API block, default behavior, installation, React 17/18 runtime dependency, and an annotation-mode configuration example.Adds a separate v7 upgrade section for the removed
babelintegration option, linked from a tip at the top of the page. A single configuration diff shows how to move custom Babel transforms intovite.plugins. Links to the Babel plugin documentation cover advanced configuration, and the upgrade section explains avoiding duplicate React Compiler transformations.The docs retain the current implementation's
compileroption name. Implementation: withastro/astro#17951.Validation: Prettier and
git diff --checkpassed.pnpm checkreported 0 errors, 0 warnings, and one existing hint. Verified the API block, package-manager installation commands, upgrade section, migration diff, and section navigation in the local preview.References