feat: Use Rolldown native MagicString#846
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
b430c15 to
378a5df
Compare
378a5df to
5e5506b
Compare
|
This actually negates most of the overhead added by our plugin when using Rolldown! It currently requires an experimental flag in the Rolldown config but I guess it will become the default eventually: |
| } | ||
|
|
||
| // Rolldown can pass a native MagicString instance in meta.magicString | ||
| if (ms?.constructor?.name === "BindingMagicString") { |
There was a problem hiding this comment.
q: could this check fail in the future since this is experimental? we could check meta.magicString again here instead. WDYT?
There was a problem hiding this comment.
We only want to return { code: magicStringInstance as string } if this is a Rolldown native instance. The value of meta.magicString doesn't matter at this point.
| 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)
rolldown/rolldown-viteusage #748Once these features make it into a Rolldow release, it looks like the changes in this PR will improve sourcemap generation for Rolldown without affecting Rollup.
With an example app of 10k modules and 10MB output file:
MagicString