Skip to content

Commit bc29d88

Browse files
authored
ref(sveltekit): Warn to delete source maps if Sentry plugin enabled source maps generation (#12072)
Now we can at least recommend to use `filesToDeleteAfterUpload` since we bumped to vite plugin 2.x with 8.0.0
1 parent c594d6a commit bc29d88

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/sveltekit/src/vite/sourceMaps.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,18 @@ export async function makeCustomSentryVitePlugins(options?: CustomSentryVitePlug
103103

104104
// Modify the config to generate source maps
105105
config: config => {
106-
// eslint-disable-next-line no-console
107-
debug && console.log('[Source Maps Plugin] Enabeling source map generation');
106+
const sourceMapsPreviouslyEnabled = !config.build?.sourcemap;
107+
if (debug && sourceMapsPreviouslyEnabled) {
108+
// eslint-disable-next-line no-console
109+
console.log('[Source Maps Plugin] Enabeling source map generation');
110+
if (!mergedOptions.sourcemaps?.filesToDeleteAfterUpload) {
111+
// eslint-disable-next-line no-console
112+
console.warn(
113+
`[Source Maps Plugin] We recommend setting the \`sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
114+
[Source Maps Plugin] Otherwise, source maps might be deployed to production, depending on your configuration`,
115+
);
116+
}
117+
}
108118
return {
109119
...config,
110120
build: {

0 commit comments

Comments
 (0)