Skip to content
This repository was archived by the owner on Oct 29, 2026. It is now read-only.

feat: Inject component annotations into HTML elements rather than React components - #851

Merged
Lms24 merged 2 commits into
getsentry:mainfrom
timfish:timfish/feat/inject-into-html
Jan 26, 2026
Merged

Lms24 merged 2 commits into
getsentry:mainfrom
timfish:timfish/feat/inject-into-html

Conversation

@timfish

@timfish timfish commented Jan 22, 2026 •

Copy link
Copy Markdown
Contributor

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.

@timfish
timfish force-pushed the timfish/feat/inject-into-html branch from cb7cb1f to 6e194f2 Compare January 23, 2026 12:25
@timfish
timfish marked this pull request as draft January 23, 2026 13:55
@timfish
timfish marked this pull request as ready for review January 24, 2026 01:26
@Lms24
Lms24 merged commit 7ea6848 into getsentry:main Jan 26, 2026
24 checks passed
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)
@timfish
timfish deleted the timfish/feat/inject-into-html branch February 17, 2026 18:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reactComponentAnnotation. I use an unintended value for a prop.

3 participants