perf(bundler-plugins): Use fast component annotation for all Rollup and Vite versions - #24437
Merged
Merged
Conversation
Contributor
size-limit report 📦
|
timfish
marked this pull request as ready for review
September 16, 2026 11:26
timfish
added this pull request to stack #24441
September 16, 2026 11:32
chargome
approved these changes
Sep 16, 2026
Member
There was a problem hiding this comment.
l: Maybe we can rename this file as this does not only with vite then right?
Collaborator
Author
There was a problem hiding this comment.
Renamed the component-annotation-vite* modules and their functions to oxc in ea27b9d. Vite 8 parses with Rolldown and everything else uses oxc-parser, and both give the oxc AST.
timfish
force-pushed
the
feat/rollup-vite-fast-component-annotation
branch
from
September 16, 2026 16:09
730b83e to
ea27b9d
Compare
isaacs
pushed a commit
that referenced
this pull request
Sep 16, 2026
…nd Vite versions (#24437) Until now, only Vite 8 used the fast (non-Babel) React component annotation transform. Rollup and Vite 5-7 always went through Babel. This PR moves every Rollup and Vite version to the fast path, as a first step toward removing Babel. Rollup's own `parseAstAsync`, which Vite 5-7 re-export, can't parse TypeScript, and the Vite plugin runs with `enforce: 'pre'`, so it sees raw `.tsx`. So this adds `oxc-parser` as a dependency for those versions. Vite 8 keeps using its own parser. `oxc-parser` needs `preserveParens: false` to give the same AST as Vite 8. It also returns syntax errors instead of throwing them, so the adapter throws on errors, and those files still fall back to Babel. Babel also stays as the fallback on platforms without an `oxc-parser` native binding. The walker's parity tests with Babel previously ran only on the Babel parser's AST. They now also run on `oxc-parser` output, which matches what Vite 8 produces. Ref #24415
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until now, only Vite 8 used the fast (non-Babel) React component annotation transform. Rollup and Vite 5-7 always went through Babel. This PR moves every Rollup and Vite version to the fast path, as a first step toward removing Babel.
Rollup's own
parseAstAsync, which Vite 5-7 re-export, can't parse TypeScript, and the Vite plugin runs withenforce: 'pre', so it sees raw.tsx. So this addsoxc-parseras a dependency for those versions. Vite 8 keeps using its own parser.oxc-parserneedspreserveParens: falseto give the same AST as Vite 8. It also returns syntax errors instead of throwing them, so the adapter throws on errors, and those files still fall back to Babel. Babel also stays as the fallback on platforms without anoxc-parsernative binding.The walker's parity tests with Babel previously ran only on the Babel parser's AST. They now also run on
oxc-parseroutput, which matches what Vite 8 produces.Ref #24415