Skip to content

feat: Add option to disable sourcemaps #561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading