@@ -39,7 +39,7 @@ async function handleSourceMapUpload(
3939 sentryEnabledSourcemaps ?: boolean ,
4040) : Promise < void > {
4141 const outputDir = nitro . options . output . serverDir ;
42- const pluginOptions = getPluginOptions ( options , sentryEnabledSourcemaps ) ;
42+ const pluginOptions = getPluginOptions ( options , sentryEnabledSourcemaps , outputDir ) ;
4343
4444 const sentryBuildPluginManager = createSentryBuildPluginManager ( pluginOptions , {
4545 buildTool : 'nitro' ,
@@ -75,7 +75,11 @@ function normalizePath(path: string): string {
7575export function getPluginOptions (
7676 options ?: SentryNitroOptions ,
7777 sentryEnabledSourcemaps ?: boolean ,
78+ outputDir ?: string ,
7879) : BundlerPluginOptions {
80+ const defaultFilesToDelete =
81+ sentryEnabledSourcemaps && outputDir ? [ `${ outputDir . replace ( / \\ / g, '/' ) } /**/*.map` ] : undefined ;
82+
7983 return {
8084 org : options ?. org ?? process . env . SENTRY_ORG ,
8185 project : options ?. project ?? process . env . SENTRY_PROJECT ,
@@ -90,8 +94,7 @@ export function getPluginOptions(
9094 disable : options ?. sourcemaps ?. disable ,
9195 assets : options ?. sourcemaps ?. assets ,
9296 ignore : options ?. sourcemaps ?. ignore ,
93- filesToDeleteAfterUpload :
94- options ?. sourcemaps ?. filesToDeleteAfterUpload ?? ( sentryEnabledSourcemaps ? [ '**/*.map' ] : undefined ) ,
97+ filesToDeleteAfterUpload : options ?. sourcemaps ?. filesToDeleteAfterUpload ?? defaultFilesToDelete ,
9598 rewriteSources : options ?. sourcemaps ?. rewriteSources ?? ( ( source : string ) => normalizePath ( source ) ) ,
9699 } ,
97100 release : options ?. release ,
0 commit comments