Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 92bc9f6

Browse files
committed
Improve
1 parent 84ff77d commit 92bc9f6

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

‎dev-packages/rollup-utils/plugins/npmPlugins.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function makeDebugBuildStatementReplacePlugin() {
126126
}
127127

128128
export function makeProductionReplacePlugin() {
129-
const pattern = /\/\*development-only\*\/[\s\S]*?\/\*end-development-only\*\//g;
129+
const pattern = /\/\*rollup-include-development-only\*\/[\s\S]*?\/\*end-rollup-include-development-only\*\//g;
130130

131131
function stripDevBlocks(code) {
132132
if (!code) return null;

‎packages/browser/src/client.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ type BrowserSpecificOptions = BrowserClientReplayOptions &
6363
* @default false
6464
*/
6565
propagateTraceparent?: boolean;
66+
67+
/**
68+
* If you use Spotlight by Sentry during development, use
69+
* this option to forward captured Sentry events to Spotlight.
70+
*
71+
* Either set it to true, or provide a specific Spotlight Sidecar URL.
72+
*
73+
* More details: https://spotlightjs.com/
74+
*
75+
* IMPORTANT: Only set this option to `true` while developing, not in production!
76+
*/
77+
spotlight?: boolean | string;
6678
};
6779
/**
6880
* Configuration options for the Sentry Browser SDK.

‎packages/browser/src/sdk.ts‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
3838
dedupeIntegration(),
3939
httpContextIntegration(),
4040
browserSessionIntegration(),
41-
/* development-only */
42-
spotlightBrowserIntegration(),
43-
/* end-development-only */
4441
];
4542
}
4643

@@ -94,14 +91,25 @@ export function init(options: BrowserOptions = {}): Client | undefined {
9491
const shouldDisableBecauseIsBrowserExtenstion =
9592
!options.skipBrowserExtensionCheck && checkAndWarnIfIsEmbeddedBrowserExtension();
9693

94+
let defaultIntegrations =
95+
options.defaultIntegrations == null ? getDefaultIntegrations(options) : options.defaultIntegrations;
96+
97+
/* rollup-include-development-only */
98+
if (options.spotlight) {
99+
if (!defaultIntegrations) {
100+
defaultIntegrations = [];
101+
}
102+
defaultIntegrations.push(spotlightBrowserIntegration());
103+
}
104+
/* end-rollup-include-development-only */
105+
97106
const clientOptions: BrowserClientOptions = {
98107
...options,
99108
enabled: shouldDisableBecauseIsBrowserExtenstion ? false : options.enabled,
100109
stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
101110
integrations: getIntegrationsToSetup({
102111
integrations: options.integrations,
103-
defaultIntegrations:
104-
options.defaultIntegrations == null ? getDefaultIntegrations(options) : options.defaultIntegrations,
112+
defaultIntegrations,
105113
}),
106114
transport: options.transport || makeFetchTransport,
107115
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /