Skip to content

fix(bundler-plugins): Keep debug IDs on Vite source maps after the preload rewrite - #24920

Merged
timfish merged 6 commits into
developfrom
fix/bundler-plugins/vite-sourcemap-debug-ids
Oct 1, 2026
Merged

timfish merged 6 commits into
developfrom
fix/bundler-plugins/vite-sourcemap-debug-ids

Conversation

@timfish

@timfish timfish commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

With sourcemaps.disable: 'disable-upload', Vite builds shipped some source maps without a debug ID. Vite's own generateBundle step rewrites every chunk with a dynamic import to add module preloading, regenerates that chunk's source map and overwrites the .map asset. This runs after the Sentry plugin's pre hook stamped the map, so the stamp is lost. Sentry then cannot match the map to the chunk.

sentryVitePlugin() now also returns a post plugin that re-stamps the maps in a post generateBundle hook. It leaves the chunk code alone, so file hashes stay valid. Reproduced on Vite 7.3 and 8.0, and the new integration fixture fails without the fix.

Split out of #23665 by @chen-anders.

chen-anders and others added 2 commits September 30, 2026 18:38
…eload rewrite

Vite regenerates the source map of every chunk that has a dynamic import in its own generateBundle hook, after the Sentry plugin stamped the map in its pre hook. With sourcemaps.disable set to disable-upload, those maps shipped without a debug ID. A post plugin now re-stamps the maps and leaves the chunk code alone.
@timfish
timfish marked this pull request as ready for review October 1, 2026 08:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a79f69b. Configure here.

…tures

The shared reader zeroes debug IDs in chunks, which hid the comparison with the source map.
@timfish
timfish requested review from isaacs and msonnb October 1, 2026 10:55
@timfish
timfish enabled auto-merge (squash) October 1, 2026 13:26
@timfish
timfish merged commit e4d6f64 into develop Oct 1, 2026
248 of 251 checks passed
@timfish
timfish deleted the fix/bundler-plugins/vite-sourcemap-debug-ids branch October 1, 2026 13:57
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