Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Jan 16, 2026

While benchmarking large projects with Rolldown, I found that MagicString.generateMap() has a large overhead. There will be ways to improve this in the future, however this issue is exacerbated by the fact that we inject up to 3 separate times via 3 separate plugins. Each of these 3 injects into the top of the source and then has to rewrite the sourcemap!

This PR combines the 3 injection plugins into a single plugin which means the chunks only need the sourcemaps generation once.

This PR retains esbuild with 3 separate plugins because I haven't worked out how to migrate that yet.

With an example app of 10k modules and 10MB output file:

Time
Rolldown 900ms
Rolldown + Sentry Rollup plugin 4.5s
Rolldown + Sentry Rollup plugin + these changes 1.8s

@github-actions
Copy link

github-actions bot commented Jan 16, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Combine injection plugins by timfish in #844

Bug Fixes 🐛

Plugin Manager

  • Respect sourcemap.ignore values for injecting debugIDs by s1gr1d in #836
  • Enable "rejectOnError" in debug by s1gr1d in #837

Other

  • (vite) Skip HTML injection for MPA but keep it for SPA by s1gr1d in #843

Documentation 📚

  • Add RELEASE.md to document release process by nicohrubec in #834

Build / dependencies / internal 🔧

  • (release) Switch from action-prepare-release to Craft by BYK in #831
  • Use pull_request_target for changelog preview by BYK in #842

Other

  • test: Ensure Debug IDs match by timfish in #840

🤖 This preview updates automatically when you update the PR.

@timfish timfish requested review from Lms24 and andreiborza January 16, 2026 16:20
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Really nice improvement, thanks Tim!

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

Nice!

@timfish timfish merged commit 825daf3 into getsentry:main Jan 19, 2026
25 checks passed
@timfish timfish deleted the timfish/feat/combine-injection-plugins branch January 19, 2026 10:00
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jan 20, 2026
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.6.1 | 4.7.0 |


## [v4.7.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#470)

- docs: Add RELEASE.md to document release process ([#834](getsentry/sentry-javascript-bundler-plugins#834))
- feat: Combine injection plugins ([#844](getsentry/sentry-javascript-bundler-plugins#844))
- fix(plugin-manager): Enable "rejectOnError" in debug ([#837](getsentry/sentry-javascript-bundler-plugins#837))
- fix(plugin-manager): Respect `sourcemap.ignore` values for injecting debugIDs ([#836](getsentry/sentry-javascript-bundler-plugins#836))
- fix(vite): Skip HTML injection for MPA but keep it for SPA ([#843](getsentry/sentry-javascript-bundler-plugins#843))

<details>
  <summary> <strong>Internal Changes</strong> </summary>

- chore: Use pull\_request\_target for changelog preview ([#842](getsentry/sentry-javascript-bundler-plugins#842))
- ci(release): Switch from action-prepare-release to Craft ([#831](getsentry/sentry-javascript-bundler-plugins#831))
- test: Ensure Debug IDs match ([#840](getsentry/sentry-javascript-bundler-plugins#840))

</details>


## [v4.6.2](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#462)

- fix(vite): Ensure sentryVitePlugin always returns an array of plugins ([#832](getsentry/sentry-javascript-bundler-plugins#832))
- fix(vite): Skip code injection for HTML facade chunks ([#830](getsentry/sentry-javascript-bundler-plugins#830))
- fix(rollup): Prevent double-injection of debug ID ([#827](getsentry/sentry-javascript-bundler-plugins#827))
- fix(esbuild): fix debug ID injection when moduleMetadata or applicationKey is set ([#828](getsentry/sentry-javascript-bundler-plugins#828))
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jan 20, 2026
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.6.1 | 4.7.0 |


## [v4.7.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#470)

- docs: Add RELEASE.md to document release process ([#834](getsentry/sentry-javascript-bundler-plugins#834))
- feat: Combine injection plugins ([#844](getsentry/sentry-javascript-bundler-plugins#844))
- fix(plugin-manager): Enable "rejectOnError" in debug ([#837](getsentry/sentry-javascript-bundler-plugins#837))
- fix(plugin-manager): Respect `sourcemap.ignore` values for injecting debugIDs ([#836](getsentry/sentry-javascript-bundler-plugins#836))
- fix(vite): Skip HTML injection for MPA but keep it for SPA ([#843](getsentry/sentry-javascript-bundler-plugins#843))

<details>
  <summary> <strong>Internal Changes</strong> </summary>

- chore: Use pull\_request\_target for changelog preview ([#842](getsentry/sentry-javascript-bundler-plugins#842))
- ci(release): Switch from action-prepare-release to Craft ([#831](getsentry/sentry-javascript-bundler-plugins#831))
- test: Ensure Debug IDs match ([#840](getsentry/sentry-javascript-bundler-plugins#840))

</details>


## [v4.6.2](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#462)

- fix(vite): Ensure sentryVitePlugin always returns an array of plugins ([#832](getsentry/sentry-javascript-bundler-plugins#832))
- fix(vite): Skip code injection for HTML facade chunks ([#830](getsentry/sentry-javascript-bundler-plugins#830))
- fix(rollup): Prevent double-injection of debug ID ([#827](getsentry/sentry-javascript-bundler-plugins#827))
- fix(esbuild): fix debug ID injection when moduleMetadata or applicationKey is set ([#828](getsentry/sentry-javascript-bundler-plugins#828))
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.

3 participants