Skip to content

perf(vite): add fast component annotation transform#944

Open
TheAlexLichter wants to merge 1 commit into
getsentry:mainfrom
TheAlexLichter:perf/vite-8-parse-transform
Open

perf(vite): add fast component annotation transform#944
TheAlexLichter wants to merge 1 commit into
getsentry:mainfrom
TheAlexLichter:perf/vite-8-parse-transform

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Resolves #943

This PR adds a port of the Babel transform forreactComponentAnnotation.enabled that works with Vite 8 + magic string, dramatically decreasing build time.

I've also added parity tests and consolidated values to avoid drift of both implementations.

Vite 7 and fallback cases will use the existing Babel transform.
Both Babel and the Vite annotation backend are lazy-loaded to avoid unnecessary startup cost.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e19e63. Configure here.

Comment thread packages/bundler-plugins/src/rollup/index.ts Outdated
@TheAlexLichter TheAlexLichter force-pushed the perf/vite-8-parse-transform branch from 2e19e63 to 0fd7570 Compare June 27, 2026 14:42
Comment on lines +1 to +2
import { transformAsync, traverse, types as t } from "@babel/core";
import { parse } from "@babel/parser";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this does use babel for testing as it is more convenient API-wise

}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 4,
lineNumber: 6,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The updated line numbers are on purpose and actually "more correct" as they now point to the actual JSX component, not just the span around it.

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.

Vite 8 /Rolldown: Do not use Babel for annotating react components

1 participant