Skip to content

fix(react-router): Preserve sourcemaps.disable when unstable_sentryVitePluginOptions is set - #22945

Merged
chargome merged 3 commits into
developfrom
cg/fix-rr-sourcemaps
Aug 3, 2026
Merged

fix(react-router): Preserve sourcemaps.disable when unstable_sentryVitePluginOptions is set#22945
chargome merged 3 commits into
developfrom
cg/fix-rr-sourcemaps

Conversation

@chargome

@chargomechargome commented Aug 3, 2026

Copy link
Copy Markdown
Member

A trailing ...unstable_sentryVitePluginOptions spread sat after sourcemaps: { disable: true }, and object spread replaces whole keys rather than deep-merging — so any user-supplied sourcemaps object dropped disable. The Vite plugin then injected a second debug ID on top of the one from sentryOnBuildEnd.

The spread now sits between the plain options and the field-wise merged objects: it can still
override flat keys (its documented contract) but can't replace sourcemaps, release, _metaOptions or reactComponentAnnotation.

supersedes #22930 — credit to @okxint for the same diagnosis.

closes#22929

@chargomechargome self-assigned this Aug 3, 2026
@chargome

Copy link
Copy Markdown
MemberAuthor

bugbot run

Comment threadpackages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts
@github-actions

github-actionsBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser29.91 kB--
@sentry/browser - with treeshaking flags28.11 kB--
@sentry/browser (incl. Tracing)47.35 kB--
@sentry/browser (incl. Tracing + Span Streaming)47.36 kB--
@sentry/browser (incl. Tracing, Profiling)52.13 kB--
@sentry/browser (incl. Tracing, Replay)86.69 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags76.13 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)91.41 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)104.05 kB--
@sentry/browser (incl. Feedback)47.22 kB--
@sentry/browser (incl. sendFeedback)34.76 kB--
@sentry/browser (incl. FeedbackAsync)39.86 kB--
@sentry/browser (incl. Metrics)30.99 kB--
@sentry/browser (incl. Logs)31.22 kB--
@sentry/browser (incl. Metrics & Logs)31.89 kB--
@sentry/react31.73 kB--
@sentry/react (incl. Tracing)49.61 kB--
@sentry/vue34.98 kB--
@sentry/vue (incl. Tracing)49.34 kB--
@sentry/svelte29.94 kB--
CDN Bundle31.98 kB--
CDN Bundle (incl. Tracing)47.72 kB--
CDN Bundle (incl. Logs, Metrics)33.55 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)49.07 kB--
CDN Bundle (incl. Replay, Logs, Metrics)72.9 kB--
CDN Bundle (incl. Tracing, Replay)85.34 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)86.64 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)91.13 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.44 kB--
CDN Bundle - uncompressed95.49 kB--
CDN Bundle (incl. Tracing) - uncompressed143.08 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed100.2 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.06 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed224.96 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed262.34 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.3 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.04 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280 kB--
@sentry/nextjs (client)52.2 kB--
@sentry/sveltekit (client)47.8 kB--
@sentry/core/server80 kB--
@sentry/core/browser51.96 kB--
@sentry/node121.89 kB--
@sentry/node/import (ESM hook with diagnostics-channel injection)0 Baddedadded
@sentry/node - without tracing85.36 kB--
@sentry/aws-serverless94.01 kB-0.01%-1 B 🔽
@sentry/cloudflare (withSentry) - minified219.34 kB--
@sentry/cloudflare (withSentry)540.41 kB--

View base workflow run

@chargome

Copy link
Copy Markdown
MemberAuthor

bugbot run

…ugin
The bundler plugin deletes these files in a `finally` block in `writeBundle` that
runs regardless of `sourcemaps.disable`, so forwarding the option removed the maps
before `sentryOnBuildEnd` could inject debug IDs and upload them - the same end
symptom as the double-injection bug, reached from the other side.
Deletion still happens in `sentryOnBuildEnd`, driven by the same user option.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome

Copy link
Copy Markdown
MemberAuthor

bugbot run

@cursorcursorBot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1d90d5b. Configure here.

@chargome
chargome marked this pull request as ready for review August 3, 2026 12:15
@chargome
chargome requested a review from a team as a code ownerAugust 3, 2026 12:15
@chargome
chargome requested review from isaacs, nicohrubec and s1gr1d and removed request for a teamAugust 3, 2026 12:15
expect(mockSentryCliInstance.releases.uploadSourceMaps).not.toHaveBeenCalled();
});

it('should let top-level sourcemaps.disable override unstable_sentryVitePluginOptions', async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm didn't we say that unstable options always have precedence? Tbh this is logaf-super-L for me since we can remove unstable options with v11 but was curious on your thoughts either way

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe I misremembered and it's the other way around

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

No, you're right actually!

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Was pre-existing, I'll streamline in a follow up

@chargome
chargome merged commit f1041f9 into developAug 3, 2026
265 checks passed
@chargome
chargome deleted the cg/fix-rr-sourcemaps branch August 3, 2026 15:05
chargome added a commit that referenced this pull request Aug 3, 2026
…entryVitePluginOptions` is set (#22966)
Backport of: #22945
Also flips `sourcemaps.disable` precedence in `sentryOnBuildEnd` so
`unstable_sentryVitePluginOptions` wins. This is not part of #22945 as
the unstable options will likely disappear there anyway.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
chargome added a commit that referenced this pull request Aug 4, 2026
…rce map upload (#22956)
This adds a build-time assertion app modelled on `nextjs-sourcemaps`,
for react router. It asserts three things about the real build output:
- exactly one debug ID per client chunk
- source maps with non-empty mappings present in the uploaded artifact
bundles
- every shipped debug ID backed by an upload. ref #22945
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

[react-router] Any unstable_sentryVitePluginOptions.sourcemaps value re-enables double debug ID injection (regression of #19874)

2 participants

@chargome@Lms24