Skip to content

Commit a7e69d3

Browse files
authored
feat: Add option to disable sourcemaps (#561)
1 parent 9bb19f3 commit a7e69d3

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

Diff for: packages/bundler-plugin-core/src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ export function sentryUnpluginFactory({
301301
plugins.push(moduleMetadataInjectionPlugin(injectionCode));
302302
}
303303

304-
if (!options.release.name) {
304+
if (options.sourcemaps?.disable) {
305+
logger.debug("Source map upload was disabled. Will not upload sourcemaps.");
306+
} else if (!options.release.name) {
305307
logger.warn(
306308
"No release name provided. Will not create release. Please set the `release.name` option to identify your release."
307309
);

Diff for: packages/bundler-plugin-core/src/sentry/telemetry.ts

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bund
8989
"delete-after-upload",
9090
!!sourcemaps?.deleteFilesAfterUpload || !!sourcemaps?.filesToDeleteAfterUpload
9191
);
92+
hub.setTag("sourcemaps-disabled", !!sourcemaps?.disable);
9293

9394
hub.setTag("react-annotate", !!reactComponentAnnotation?.enabled);
9495

Diff for: packages/bundler-plugin-core/src/types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ export interface Options {
9090
* Options for source maps uploading.
9191
*/
9292
sourcemaps?: {
93+
/**
94+
* Disables all functionality related to sourcemaps.
95+
*
96+
* Defaults to `false`.
97+
*/
98+
disable?: boolean;
99+
93100
/**
94101
* A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry.
95102
*

Diff for: packages/dev-utils/src/generate-documentation-table.ts

+6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ errorHandler: (err) => {
102102
fullDescription:
103103
"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.",
104104
},
105+
{
106+
name: "disable",
107+
type: "boolean",
108+
fullDescription:
109+
"Disables all functionality related to sourcemaps.\n\nDefaults to `false`.",
110+
},
105111
],
106112
},
107113

0 commit comments

Comments
 (0)