diff --git a/packages/bundler-plugin-core/src/index.ts b/packages/bundler-plugin-core/src/index.ts index 8f91ced2..d7dc2585 100644 --- a/packages/bundler-plugin-core/src/index.ts +++ b/packages/bundler-plugin-core/src/index.ts @@ -301,7 +301,9 @@ export function sentryUnpluginFactory({ plugins.push(moduleMetadataInjectionPlugin(injectionCode)); } - if (!options.release.name) { + if (options.sourcemaps?.disable) { + logger.debug("Source map upload was disabled. Will not upload sourcemaps."); + } else if (!options.release.name) { logger.warn( "No release name provided. Will not create release. Please set the `release.name` option to identify your release." ); diff --git a/packages/bundler-plugin-core/src/sentry/telemetry.ts b/packages/bundler-plugin-core/src/sentry/telemetry.ts index 7167bb29..452f605c 100644 --- a/packages/bundler-plugin-core/src/sentry/telemetry.ts +++ b/packages/bundler-plugin-core/src/sentry/telemetry.ts @@ -89,6 +89,7 @@ export function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bund "delete-after-upload", !!sourcemaps?.deleteFilesAfterUpload || !!sourcemaps?.filesToDeleteAfterUpload ); + hub.setTag("sourcemaps-disabled", !!sourcemaps?.disable); hub.setTag("react-annotate", !!reactComponentAnnotation?.enabled); diff --git a/packages/bundler-plugin-core/src/types.ts b/packages/bundler-plugin-core/src/types.ts index 3cac126d..b7799e08 100644 --- a/packages/bundler-plugin-core/src/types.ts +++ b/packages/bundler-plugin-core/src/types.ts @@ -90,6 +90,13 @@ export interface Options { * Options for source maps uploading. */ sourcemaps?: { + /** + * Disables all functionality related to sourcemaps. + * + * Defaults to `false`. + */ + disable?: boolean; + /** * A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry. * diff --git a/packages/dev-utils/src/generate-documentation-table.ts b/packages/dev-utils/src/generate-documentation-table.ts index 1606e510..e79dc639 100644 --- a/packages/dev-utils/src/generate-documentation-table.ts +++ b/packages/dev-utils/src/generate-documentation-table.ts @@ -102,6 +102,12 @@ errorHandler: (err) => { fullDescription: "A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact upload to Sentry has been completed.\n\nThe globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)\n\nUse the `debug` option to print information about which files end up being deleted.", }, + { + name: "disable", + type: "boolean", + fullDescription: + "Disables all functionality related to sourcemaps.\n\nDefaults to `false`.", + }, ], },