Commit 30cd594
authored
perf(bundler-plugins): Use fast component annotation for all Rollup and 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 #244151 parent 2cbf219 commit 30cd594
0 file changed
0 commit comments