Skip to content

fix(react-router): prevent unstable_sentryVitePluginOptions spread from overwriting sourcemaps - #22930

Draft
okxint wants to merge 1 commit into
getsentry:developfrom
okxint:fix/react-router-sourcemaps-spread-overwrite
Draft

fix(react-router): prevent unstable_sentryVitePluginOptions spread from overwriting sourcemaps#22930
okxint wants to merge 1 commit into
getsentry:developfrom
okxint:fix/react-router-sourcemaps-spread-overwrite

Conversation

@okxint

@okxint okxint commented Aug 1, 2026

Copy link
Copy Markdown

makeCustomSentryVitePlugins builds a sourcemaps: { disable: true, ...user } object to prevent double debug-ID injection during the React Router build. However, the trailing ...unstable_sentryVitePluginOptions spread on the next line overwrites the entire sourcemaps key with the user's raw value, dropping disable: true.

JavaScript's object spread is shallow — when both sourcemaps: { disable: true, ...userSourcemaps } and ...unstable_sentryVitePluginOptions are present on the same level, the second sourcemaps key wins unconditionally.

Fix: destructure sourcemaps out of unstable_sentryVitePluginOptions before the call, then use userSourcemaps inside the already-merged object and spread the remainder separately. This keeps user customizations on all other keys while preserving disable: true.

Fixes #22929

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.

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

1 participant