Skip to content

Commit 6e4bd4c

Browse files
committed
reduce bundle size??!
1 parent aab05e4 commit 6e4bd4c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dev-packages/rollup-utils/plugins/bundlePlugins.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ export function makeIsDebugBuildPlugin(includeDebugging) {
6363
export function makeSetSDKSourcePlugin(sdkSource) {
6464
return replace({
6565
preventAssignment: false,
66+
delimiters: ['', ''],
6667
values: {
67-
__SENTRY_SDK_SOURCE__: JSON.stringify(sdkSource),
68+
"/* ref:__SENTRY_SDK_SOURCE__ */": `return ${JSON.stringify(sdkSource)};`,
6869
},
6970
});
7071
}

packages/utils/src/env.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
declare const __SENTRY_BROWSER_BUNDLE__: boolean | undefined;
1717

18-
declare const __SENTRY_SDK_SOURCE__: SdkSource | undefined;
19-
2018
export type SdkSource = 'npm' | 'cdn' | 'loader';
2119

2220
/**
@@ -32,5 +30,6 @@ export function isBrowserBundle(): boolean {
3230
* Get source of SDK.
3331
*/
3432
export function getSDKSource(): SdkSource {
35-
return typeof __SENTRY_SDK_SOURCE__ !== 'undefined' ? __SENTRY_SDK_SOURCE__ : 'npm';
33+
// This comment is used to identify this line in the CDN bundle build step and replace this with "return 'cdn';"
34+
/* ref:__SENTRY_SDK_SOURCE__ */ return 'npm';
3635
}

0 commit comments

Comments
 (0)