Skip to content

Commit 547ce6a

Browse files
committed
log turbopack sourcemaps info only in debug mode
1 parent 871be5c commit 547ce6a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packages/nextjs/src/config/withSentryConfig.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,21 @@ function getFinalConfigObject(
329329
if (isTurbopackSupported && isTurbopack && !userSentryOptions.sourcemaps?.disable) {
330330
// Only set if not already configured by user
331331
if (incomingUserNextConfigObject.productionBrowserSourceMaps === undefined) {
332-
// eslint-disable-next-line no-console
333-
console.log('[@sentry/nextjs] Automatically enabling browser source map generation for turbopack build.');
332+
if (userSentryOptions.debug) {
333+
// eslint-disable-next-line no-console
334+
console.log('[@sentry/nextjs] Automatically enabling browser source map generation for turbopack build.');
335+
}
334336
incomingUserNextConfigObject.productionBrowserSourceMaps = true;
335337

336338
// Enable source map deletion if not explicitly disabled
337339
if (userSentryOptions.sourcemaps?.deleteSourcemapsAfterUpload === undefined) {
338-
// eslint-disable-next-line no-console
339-
console.warn(
340-
'[@sentry/nextjs] Source maps will be automatically deleted after being uploaded to Sentry. If you want to keep the source maps, set the `sourcemaps.deleteSourcemapsAfterUpload` option to false in `withSentryConfig()`. If you do not want to generate and upload sourcemaps at all, set the `sourcemaps.disable` option to true.',
341-
);
340+
if (userSentryOptions.debug) {
341+
// eslint-disable-next-line no-console
342+
console.warn(
343+
'[@sentry/nextjs] Source maps will be automatically deleted after being uploaded to Sentry. If you want to keep the source maps, set the `sourcemaps.deleteSourcemapsAfterUpload` option to false in `withSentryConfig()`. If you do not want to generate and upload sourcemaps at all, set the `sourcemaps.disable` option to true.',
344+
);
345+
}
346+
342347
userSentryOptions.sourcemaps = {
343348
...userSentryOptions.sourcemaps,
344349
deleteSourcemapsAfterUpload: true,

0 commit comments

Comments
 (0)