feat: Inject component annotations into HTML elements rather than React components#851
Merged
Lms24 merged 2 commits intogetsentry:mainfrom Jan 26, 2026
Merged
Conversation
s1gr1d
reviewed
Jan 23, 2026
s1gr1d
approved these changes
Jan 23, 2026
cb7cb1f to
6e194f2
Compare
Lms24
approved these changes
Jan 26, 2026
7 tasks
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Jan 27, 2026
| datasource | package | from | to | | ---------- | ------------------- | ----- | ----- | | npm | @sentry/vite-plugin | 4.7.0 | 4.8.0 | ## [v4.8.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#480) ##### New Features ✨ - Inject component annotations into HTML elements rather than React components by [@timfish](https://github.com/timfish) in [#851](getsentry/sentry-javascript-bundler-plugins#851) - Combine injection snippets by [@timfish](https://github.com/timfish) in [#853](getsentry/sentry-javascript-bundler-plugins#853) - Use Rolldown native `MagicString` by [@timfish](https://github.com/timfish) in [#846](getsentry/sentry-javascript-bundler-plugins#846)
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.
Rather than inject attributes into React components which can cause incompatibilities with props, this PR adds an alternative version of the babel plugin that instead injects attributes into every HTML element in the components root.
This can be enabled by setting
reactComponentAnnotation: { enabled: true, _experimentalInjectIntoHtml: true }.I created a separate babel transform plugin so I didn't have to hack around and get the logic working in the old plugin. It's much more simple. The experimental option switches between the two plugins.