Skip to content

Commit 087b0c6

Browse files
author
Luca Forstner
authored
feat: Add bundleSizeOptimizations.excludeTracing option as alias to deprecated bundleSizeOptimizations.excludePerformanceMonitoring (#582)
1 parent 6867395 commit 087b0c6

File tree

3 files changed

+71
-21
lines changed

3 files changed

+71
-21
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ export function sentryUnpluginFactory({
237237
if (bundleSizeOptimizations.excludeDebugStatements) {
238238
replacementValues["__SENTRY_DEBUG__"] = false;
239239
}
240-
if (bundleSizeOptimizations.excludePerformanceMonitoring) {
240+
if (
241+
bundleSizeOptimizations.excludePerformanceMonitoring ||
242+
bundleSizeOptimizations.excludeTracing
243+
) {
241244
replacementValues["__SENTRY_TRACE__"] = false;
242245
}
243246
if (bundleSizeOptimizations.excludeReplayCanvas) {

packages/bundler-plugin-core/src/types.ts

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -245,47 +245,63 @@ export interface Options {
245245
*/
246246
bundleSizeOptimizations?: {
247247
/**
248-
* If set to true, the plugin will try to tree-shake debug statements out.
249-
* Note that the success of this depends on tree shaking generally being enabled in your build.
248+
* If set to `true`, the plugin will attempt to tree-shake (remove) any debugging code within the Sentry SDK.
249+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
250+
*
251+
* Setting this option to `true` will disable features like the SDK's `debug` option.
250252
*/
251253
excludeDebugStatements?: boolean;
252254

253255
/**
254-
* If set to true, the plugin will try to tree-shake performance monitoring statements out.
255-
* Note that the success of this depends on tree shaking generally being enabled in your build.
256-
* Attention: DO NOT enable this when you're using any performance monitoring-related SDK features (e.g. Sentry.startTransaction()).
257-
* This flag is intended to be used in combination with packages like @sentry/next or @sentry/sveltekit,
258-
* which automatically include performance monitoring functionality.
256+
* If set to `true`, the plugin will attempt to tree-shake (remove) code within the Sentry SDK that is related to tracing and performance monitoring.
257+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
258+
*
259+
* **Notice**: Do not enable this when you're using any performance monitoring-related SDK features (e.g. `Sentry.startTransaction()`).
260+
*
261+
* @deprecated This option has been replaced with the `excludeTracing`. Currently, this option is an alias for `excludeTracing` but `excludePerformanceMonitoring` will be removed in the next major version.
259262
*/
263+
// TODO(v3): Remove this option
260264
excludePerformanceMonitoring?: boolean;
261265

262266
/**
263-
* If set to true, the plugin will try to tree-shake Session Replay's Canvas recording functionality out.
264-
* You can safely do this when you do not want to capture any Canvas activity via Replay.
265-
* Note that the success of this depends on tree shaking generally being enabled in your build.
267+
* If set to `true`, the plugin will attempt to tree-shake (remove) code within the Sentry SDK that is related to tracing and performance monitoring.
268+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
269+
*
270+
* **Notice:** Do not enable this when you're using any performance monitoring-related SDK features (e.g. `Sentry.startTransaction()`).
271+
*/
272+
excludeTracing?: boolean;
273+
274+
/**
275+
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay Canvas recording functionality.
276+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
277+
*
278+
* You can safely do this when you do not want to capture any Canvas activity via Sentry Session Replay.
266279
*
267-
* @deprecated Versions v7.78.0 and later of the Sentry JavaScript SDKs do not include canvas support by default, making this option redundant.
280+
* @deprecated In versions v7.78.0 and later of the Sentry JavaScript SDKs, canvas recording is opt-in making this option redundant.
268281
*/
269282
excludeReplayCanvas?: boolean;
270283

271284
/**
272-
* If set to true, the plugin will try to tree-shake Session Replay's Shadow DOM recording functionality out.
273-
* You can safely do this when you do not want to capture any Shadow DOM activity via Replay.
274-
* Note that the success of this depends on tree shaking generally being enabled in your build.
285+
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay Shadow DOM recording functionality.
286+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
287+
*
288+
* This option is safe to be used when you do not want to capture any Shadow DOM activity via Sentry Session Replay.
275289
*/
276290
excludeReplayShadowDom?: boolean;
277291

278292
/**
279-
* If set to true, the plugin will try to tree-shake Session Replay's IFrame recording functionality out.
280-
* You can safely do this when you do not want to capture any IFrame activity via Replay.
281-
* Note that the success of this depends on tree shaking generally being enabled in your build.
293+
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay `iframe` recording functionality.
294+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
295+
*
296+
* You can safely do this when you do not want to capture any `iframe` activity via Sentry Session Replay.
282297
*/
283298
excludeReplayIframe?: boolean;
284299

285300
/**
286-
* If set to true, the plugin will try to tree-shake Session Replay's Compression Web Worker out.
287-
* You should only do this if you manually host a compression worker and configure it in your Replay config via `workerUrl`.
288-
* Note that the success of this depends on tree shaking generally being enabled in your build.
301+
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay's Compression Web Worker.
302+
* Note that the success of this depends on tree shaking being enabled in your build tooling.
303+
*
304+
* **Notice:** You should only do use this option if you manually host a compression worker and configure it in your Sentry Session Replay integration config via the `workerUrl` option.
289305
*/
290306
excludeReplayWorker?: boolean;
291307
};

packages/dev-utils/src/generate-documentation-table.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,37 @@ type IncludeEntry = {
343343
},
344344
],
345345
},
346+
{
347+
name: "bundleSizeOptimizations",
348+
fullDescription: `Options related to bundle size optimizations. These options will allow you to optimize and reduce the bundle size of the Sentry SDK.`,
349+
children: [
350+
{
351+
name: "excludeDebugStatements",
352+
type: "boolean",
353+
fullDescription: `If set to \`true\`, the plugin will attempt to tree-shake (remove) any debugging code within the Sentry SDK.\nNote that the success of this depends on tree shaking being enabled in your build tooling.\n\nSetting this option to \`true\` will disable features like the SDK's \`debug\` option.`,
354+
},
355+
{
356+
name: "excludeTracing",
357+
type: "boolean",
358+
fullDescription: `If set to \`true\`, the plugin will attempt to tree-shake (remove) code within the Sentry SDK that is related to tracing and performance monitoring.\nNote that the success of this depends on tree shaking being enabled in your build tooling.\n\n**Notice:** Do not enable this when you're using any performance monitoring-related SDK features (e.g. \`Sentry.startTransaction()\`).`,
359+
},
360+
{
361+
name: "excludeReplayShadowDom",
362+
type: "boolean",
363+
fullDescription: `If set to \`true\`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay Shadow DOM recording functionality.\nNote that the success of this depends on tree shaking being enabled in your build tooling.\n\nThis option is safe to be used when you do not want to capture any Shadow DOM activity via Sentry Session Replay.`,
364+
},
365+
{
366+
name: "excludeReplayIframe",
367+
type: "boolean",
368+
fullDescription: `If set to \`true\`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay \`iframe\` recording functionality.\nNote that the success of this depends on tree shaking being enabled in your build tooling.\n\nYou can safely do this when you do not want to capture any \`iframe\` activity via Sentry Session Replay.`,
369+
},
370+
{
371+
name: "excludeReplayWorker",
372+
type: "boolean",
373+
fullDescription: `If set to \`true\`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay's Compression Web Worker.\nNote that the success of this depends on tree shaking being enabled in your build tooling.\n\n**Notice:** You should only do use this option if you manually host a compression worker and configure it in your Sentry Session Replay integration config via the \`workerUrl\` option.`,
374+
},
375+
],
376+
},
346377
{
347378
name: "reactComponentAnnotation",
348379
fullDescription: `Options related to react component name annotations.

0 commit comments

Comments
 (0)