Skip to content

Commit

Permalink
reduce bundle size??!
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Aug 28, 2024
1 parent 68239ed commit a1b2edb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dev-packages/rollup-utils/plugins/bundlePlugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ export function makeIsDebugBuildPlugin(includeDebugging) {
export function makeSetSDKSourcePlugin(sdkSource) {
return replace({
preventAssignment: false,
delimiters: ['', ''],
values: {
__SENTRY_SDK_SOURCE__: JSON.stringify(sdkSource),
"/* ref:__SENTRY_SDK_SOURCE__ */": `return ${JSON.stringify(sdkSource)};`,
},
});
}
Expand Down
5 changes: 2 additions & 3 deletions packages/utils/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

declare const __SENTRY_BROWSER_BUNDLE__: boolean | undefined;

declare const __SENTRY_SDK_SOURCE__: SdkSource | undefined;

export type SdkSource = 'npm' | 'cdn' | 'loader';

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

0 comments on commit a1b2edb

Please sign in to comment.