Skip to content

Commit e5e5210

Browse files
nicohrubecclaude
andcommitted
ref(nuxt): Preserve original filesToDeleteAfterUpload truthiness semantics
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ab62810 commit e5e5210

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

packages/nuxt/src/vite/sourceMaps.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,17 @@ function resolveFilesToDeleteAfterUpload(
171171
moduleOptions: SentryNuxtModuleOptions,
172172
shouldDeleteFilesFallback?: { client: boolean; server: boolean },
173173
): string | Array<string> | undefined {
174-
const userFilesToDeleteAfterUpload = moduleOptions.sourcemaps?.filesToDeleteAfterUpload;
175-
if (typeof userFilesToDeleteAfterUpload !== 'undefined') {
176-
return userFilesToDeleteAfterUpload;
177-
}
178-
179174
const shouldDeleteFilesAfterUpload = shouldDeleteFilesFallback?.client || shouldDeleteFilesFallback?.server;
180-
if (!shouldDeleteFilesAfterUpload) {
181-
return undefined;
182-
}
183-
184175
const fallbackFilesToDelete = [
185176
...(shouldDeleteFilesFallback?.client ? ['.*/**/public/**/*.map'] : []),
186177
...(shouldDeleteFilesFallback?.server
187178
? ['.*/**/server/**/*.map', '.*/**/output/**/*.map', '.*/**/function/**/*.map']
188179
: []),
189180
];
190181

191-
if (moduleOptions.debug) {
182+
const filesToDeleteAfterUpload = moduleOptions.sourcemaps?.filesToDeleteAfterUpload;
183+
184+
if (typeof filesToDeleteAfterUpload === 'undefined' && shouldDeleteFilesAfterUpload && moduleOptions.debug) {
192185
// eslint-disable-next-line no-console
193186
console.log(
194187
`[Sentry] Setting \`sentry.sourcemaps.filesToDeleteAfterUpload: [${fallbackFilesToDelete
@@ -198,7 +191,11 @@ function resolveFilesToDeleteAfterUpload(
198191
);
199192
}
200193

201-
return fallbackFilesToDelete;
194+
return filesToDeleteAfterUpload
195+
? filesToDeleteAfterUpload
196+
: shouldDeleteFilesAfterUpload
197+
? fallbackFilesToDelete
198+
: undefined;
202199
}
203200

204201
/* There are multiple ways to set up source maps (https://github.com/getsentry/sentry-javascript/issues/13993 and https://github.com/getsentry/sentry-javascript/pull/15859)

0 commit comments

Comments
 (0)