Skip to content

Commit

Permalink
ref(sveltekit): Warn to delete source maps if Sentry plugin enabled s…
Browse files Browse the repository at this point in the history
…ource maps generation (#12072)

Now we can at least recommend to use `filesToDeleteAfterUpload` since we
bumped to vite plugin 2.x with 8.0.0
  • Loading branch information
Lms24 authored May 16, 2024
1 parent c594d6a commit bc29d88
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/sveltekit/src/vite/sourceMaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,18 @@ export async function makeCustomSentryVitePlugins(options?: CustomSentryVitePlug

// Modify the config to generate source maps
config: config => {
// eslint-disable-next-line no-console
debug && console.log('[Source Maps Plugin] Enabeling source map generation');
const sourceMapsPreviouslyEnabled = !config.build?.sourcemap;
if (debug && sourceMapsPreviouslyEnabled) {
// eslint-disable-next-line no-console
console.log('[Source Maps Plugin] Enabeling source map generation');
if (!mergedOptions.sourcemaps?.filesToDeleteAfterUpload) {
// eslint-disable-next-line no-console
console.warn(
`[Source Maps Plugin] We recommend setting the \`sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
[Source Maps Plugin] Otherwise, source maps might be deployed to production, depending on your configuration`,
);
}
}
return {
...config,
build: {
Expand Down

0 comments on commit bc29d88

Please sign in to comment.