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

Cater for when bundlers have already injected Debug IDs #710

Closed

Description

@timfish

Recent versions of Webpack, Rollup and Vite can now inject debug IDs into source and sourcemaps files.

If source and sourcemap already contains a debug ID, the bundler plugins should use these existing IDs and should only inject the polyfill.

Activity

  1. self-assigned this
    on Mar 30, 2025
  2. timfish commented on Apr 26, 2025

    @timfish
    ContributorAuthor

    Vite

    So it doesn't look like we'll be able to fix this very easily with Vite because Vite calls the plugins before the debugId and sourcemap comments have been determined or injected!

    Rollup

    Same goes for Rollup. Rollup injects the debug IDs during the Render Chunks stage but this is after our plugins renderChunks has been called.

    Webpack

    Our webpack plugin currently injects the debug ID polyfill using the BannerPlugin. If we're going to fix this in webpack we'll need a custom plugin that comes after the sourcemap plugin. I think we're going to see similar issues as above because once sourcemaps have been generated, you don't really want to be modifying the code!

    All the bundlers are injecting debug IDs as the very last stage which was the right call, it just makes it hard for us to capture these and inject our polyfill because the output has already been determined.

    Alternative options?

    We could generate the Debug IDs using the same code that the bundlers are using. That way, the debug IDs would match the bundler?

  3. lforst commented on Apr 28, 2025

    @lforst

    I have an idea. We can update our plugins to simply write over the existing debug ID comment with the debug ID that was injected within the snippet right before uploading. We are already injecting a "pattern-matchable" string for exactly this purpose with e._sentryDebugIdIdentifier="sentry-dbid-${debugId}"

  4. timfish commented on Apr 28, 2025

    @timfish
    ContributorAuthor

    We can update our plugins to simply write over the existing debug ID comment with the debug ID that was injected within the snippet right before uploading

    Yep, good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions