Skip to content

Commit 562a06d

Browse files
Keep sourcemaps in build output
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
1 parent 623453e commit 562a06d

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

vite.config.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ if (SENTRY_UPLOAD && MODE === 'production') {
1818
const tokenImpliesOrg = Boolean(authToken?.startsWith('sntrys_'))
1919

2020
// If upload is "on" but required settings are missing, the Sentry plugin will
21-
// skip upload but still run the delete-after-upload step, which results in
22-
// `.map` URLs returning our HTML 404 page.
21+
// just warn + skip the upload. Fail fast so we don't silently deploy without
22+
// sourcemaps in Sentry.
2323
if (!authToken) {
2424
throw new Error('SENTRY_UPLOAD is enabled, but SENTRY_AUTH_TOKEN is missing')
2525
}
@@ -52,8 +52,7 @@ export default defineConfig(async () => {
5252
org: process.env.SENTRY_ORG,
5353
project: process.env.SENTRY_PROJECT,
5454
// By default the bundler plugin logs and continues on upload/release
55-
// errors. If we then also delete maps, Sentry ends up trying to fetch
56-
// `*.map` and receiving our HTML 404 page instead.
55+
// errors. Fail the build so we don't deploy with broken symbolication.
5756
errorHandler: (err) => {
5857
throw err
5958
},
@@ -63,15 +62,6 @@ export default defineConfig(async () => {
6362
auto: true,
6463
},
6564
},
66-
sourcemaps: {
67-
// NOTE: This option expects globs (or a Promise resolving to globs),
68-
// not the *result* of running glob at config-eval time.
69-
//
70-
// We only delete Vite/React Router client maps here. The `server-build`
71-
// sourcemaps are produced by a separate esbuild step and are not uploaded
72-
// by this plugin.
73-
filesToDeleteAfterUpload: ['./build/client/**/*.map'],
74-
},
7565
})
7666
: null,
7767
],

0 commit comments

Comments
 (0)