Skip to content

perf(bundler-plugins): Use fast component annotation for HTML injection mode - #24440

Open
timfish wants to merge 2 commits into
developfrom
feat/fast-annotation-html-injection
Open

timfish wants to merge 2 commits into
developfrom
feat/fast-annotation-html-injection

Conversation

@timfish

@timfish timfish commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #24437.

When reactComponentAnnotation._experimentalInjectIntoHtml was set, annotation always went through Babel, even on Vite 8. This PR ports that mode to the fast walker, so every Rollup and Vite build now uses the fast path. The next step moves Webpack and the Next.js Turbopack loader over, and after that Babel can be removed.

HTML mode finds components the same way as the normal mode. The difference is in how it handles JSX. It adds only data-sentry-component, and only to the first HTML elements below each component root, looking through fragments and component elements to find them. The port keeps two Babel quirks so the output stays the same: element names starting with _ or $ count as HTML elements, and anonymous classes get data-sentry-component="".

The new tests compare the walker with the Babel HTML plugin on both @babel/parser and oxc-parser output.

Ref #24415

@timfish
timfish added this pull request to stack #24441 September 16, 2026 11:32
@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.09 kB - -
@sentry/browser - with treeshaking flags 27.35 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.26 kB - -
@sentry/browser (incl. Tracing) 50.6 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.62 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.61 kB - -
@sentry/browser (incl. Tracing, Replay) 90.15 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.25 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.85 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.83 kB - -
@sentry/browser (incl. Feedback) 46.62 kB - -
@sentry/browser (incl. sendFeedback) 34.15 kB - -
@sentry/browser (incl. FeedbackAsync) 39.26 kB - -
@sentry/browser (incl. Metrics) 30.1 kB - -
@sentry/browser (incl. Logs) 30.35 kB - -
@sentry/browser (incl. Metrics & Logs) 31.02 kB - -
@sentry/react 30.84 kB - -
@sentry/react (incl. Tracing) 52.94 kB - -
@sentry/vue 36.34 kB - -
@sentry/vue (incl. Tracing) 52.91 kB - -
@sentry/svelte 29.11 kB - -
CDN Bundle 30.8 kB - -
CDN Bundle (incl. Tracing) 51.15 kB - -
CDN Bundle (incl. Logs, Metrics) 33.06 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.75 kB - -
CDN Bundle (incl. Tracing, Replay) 88.69 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.73 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.78 kB - -
CDN Bundle - uncompressed 91.16 kB - -
CDN Bundle (incl. Tracing) - uncompressed 152.66 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.73 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 158.61 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.14 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 272.23 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 278.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 285.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 291.86 kB - -
@sentry/nextjs (client) 55.27 kB - -
@sentry/sveltekit (client) 51.05 kB - -
@sentry/core/server 39.63 kB - -
@sentry/core/browser 13.66 kB - -
@sentry/node 132.37 kB +0.02% +18 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.03 kB - -
@sentry/node - without tracing 89.82 kB +0.04% +30 B 🔺
@sentry/node - without channel injection 111.23 kB +0.02% +17 B 🔺
@sentry/aws-serverless 98.06 kB +0.03% +25 B 🔺
@sentry/cloudflare (withSentry) - minified 204.52 kB - -
@sentry/cloudflare (withSentry) 508.73 kB - -

View base workflow run

@timfish
timfish force-pushed the feat/fast-annotation-html-injection branch from b9714bb to f9fc3b3 Compare September 16, 2026 16:09
Base automatically changed from feat/rollup-vite-fast-component-annotation to develop September 16, 2026 17:02
@timfish
timfish force-pushed the feat/fast-annotation-html-injection branch from f9fc3b3 to 66f9e6b Compare September 16, 2026 17:02
@timfish
timfish marked this pull request as ready for review September 16, 2026 17:02
@timfish
timfish requested a review from chargome September 16, 2026 17:02
@timfish
timfish force-pushed the feat/fast-annotation-html-injection branch from 66f9e6b to d6d9305 Compare September 17, 2026 09:26
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.

1 participant