From 75d675cb7f64226df5f801acb0e112ea44e5962a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 3 Aug 2026 03:58:26 +0000 Subject: [PATCH] fix: stop Sentry double debug IDs breaking client source maps Passing sourcemaps through unstable_sentryVitePluginOptions overwrites sourcemaps.disable: true in @sentry/react-router, so each client chunk gets two debug IDs and Sentry symbolicates against the one without a map. Move release to the supported top-level options, drop the unstable sourcemaps override (sentryOnBuildEnd already deletes maps), and use hidden source maps so public assets do not advertise map URLs. Co-authored-by: Kent C. Dodds --- vite.config.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index d42301711..9674b80a4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -43,7 +43,9 @@ export default defineConfig((config) => { } }, - sourcemap: true, + // 'hidden' emits maps for Sentry upload but omits //# sourceMappingURL= + // so public /assets never advertise map URLs (esp. when auth token is unset) + sourcemap: 'hidden', }, server: { watch: { @@ -84,20 +86,20 @@ export default defineConfig((config) => { } }) +// Keep release on the supported top-level fields. Do not pass `sourcemaps` +// through `unstable_sentryVitePluginOptions` — that overwrites the plugin's +// `sourcemaps.disable: true` and injects a second debug ID per chunk +// (getsentry/sentry-javascript#22929). sentryOnBuildEnd deletes maps via its +// default `${buildDirectory}/**/*.map` glob. const sentryConfig: SentryReactRouterBuildOptions = { authToken: process.env.SENTRY_AUTH_TOKEN, org: process.env.SENTRY_ORG, project: process.env.SENTRY_PROJECT, - unstable_sentryVitePluginOptions: { - release: { - name: process.env.COMMIT_SHA, - setCommits: { - auto: true, - }, - }, - sourcemaps: { - filesToDeleteAfterUpload: ['./build/**/*.map'], + release: { + name: process.env.COMMIT_SHA, + setCommits: { + auto: true, }, }, }