Skip to content

Commit 8f850d0

Browse files
committed
change condition for uploading source maps
1 parent 19ecfaa commit 8f850d0

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

packages/nuxt/src/vite/buildEndUpload.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ export async function handleBuildDoneHook(sentryModuleOptions: SentryNuxtModuleO
2121
console.log('[Sentry] Running build:done hook to upload source maps.');
2222
}
2323

24-
// eslint-disable-next-line deprecation/deprecation
25-
const sourceMapsUploadOptions = sentryModuleOptions.sourceMapsUploadOptions || {};
26-
27-
const sourceMapsEnabled =
28-
sentryModuleOptions.sourcemaps?.disable === true
29-
? false
30-
: sentryModuleOptions.sourcemaps?.disable === false
31-
? true
32-
: // eslint-disable-next-line deprecation/deprecation
33-
(sourceMapsUploadOptions.enabled ?? true);
34-
35-
if (!sourceMapsEnabled) {
36-
return;
37-
}
38-
3924
let createSentryBuildPluginManager: typeof createSentryBuildPluginManagerType | undefined;
4025
try {
4126
const bundlerPluginCore = await import('@sentry/bundler-plugin-core');
@@ -93,12 +78,26 @@ export async function handleBuildDoneHook(sentryModuleOptions: SentryNuxtModuleO
9378

9479
await sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal();
9580
await sentryBuildPluginManager.createRelease();
96-
await sentryBuildPluginManager.injectDebugIds([outputDir]);
97-
await sentryBuildPluginManager.uploadSourcemaps([outputDir], {
98-
prepareArtifacts: false,
99-
});
10081

101-
await sentryBuildPluginManager.deleteArtifacts();
82+
// eslint-disable-next-line deprecation/deprecation
83+
const sourceMapsUploadOptions = sentryModuleOptions.sourceMapsUploadOptions || {};
84+
85+
const sourceMapsEnabled =
86+
sentryModuleOptions.sourcemaps?.disable === true
87+
? false
88+
: sentryModuleOptions.sourcemaps?.disable === false
89+
? true
90+
: // eslint-disable-next-line deprecation/deprecation
91+
(sourceMapsUploadOptions.enabled ?? true);
92+
93+
if (sourceMapsEnabled) {
94+
await sentryBuildPluginManager.injectDebugIds([outputDir]);
95+
await sentryBuildPluginManager.uploadSourcemaps([outputDir], {
96+
// We don't want to prepare the artifacts because we injected debug ids manually before
97+
prepareArtifacts: false,
98+
});
99+
await sentryBuildPluginManager.deleteArtifacts();
100+
}
102101

103102
// eslint-disable-next-line no-console
104103
debug && console.log('[Sentry] Successfully uploaded source maps.');

0 commit comments

Comments
 (0)