Skip to content

Commit

Permalink
feat: Add option to disable sourcemaps (#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Jun 27, 2024
1 parent 9bb19f3 commit a7e69d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/bundler-plugin-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down
1 change: 1 addition & 0 deletions packages/bundler-plugin-core/src/sentry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 7 additions & 0 deletions packages/bundler-plugin-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
6 changes: 6 additions & 0 deletions packages/dev-utils/src/generate-documentation-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.",
},
],
},

Expand Down

0 comments on commit a7e69d3

Please sign in to comment.