@@ -127,26 +127,7 @@ declare const __SENTRY_RELEASE__: string | undefined;
127127 * @see {@link BrowserOptions } for documentation on configuration options.
128128 */
129129export function init ( browserOptions : BrowserOptions = { } ) : Client | undefined {
130- // Note: If we call `initWithDefaultIntegrations()` here, webpack seems unable to tree-shake the DEBUG_BUILD usage inside of it
131- // So we duplicate the logic here like this to ensure maximum saved bytes
132- const options = applyDefaultOptions ( browserOptions ) ;
133- const defaultIntegrations = getDefaultIntegrations ( browserOptions ) ;
134-
135- const isBrowserExtension = ! options . skipBrowserExtensionCheck && shouldShowBrowserExtensionError ( ) ;
136-
137- if ( DEBUG_BUILD ) {
138- logBrowserEnvironmentWarnings ( {
139- browserExtension : isBrowserExtension ,
140- fetch : ! supportsFetch ( ) ,
141- } ) ;
142- }
143-
144- if ( isBrowserExtension ) {
145- return ;
146- }
147-
148- const clientOptions = getClientOptions ( options , defaultIntegrations ) ;
149- return initAndBind ( BrowserClient , clientOptions ) ;
130+ return _init ( browserOptions , getDefaultIntegrations ( browserOptions ) ) ;
150131}
151132
152133/**
@@ -160,19 +141,28 @@ export function init(browserOptions: BrowserOptions = {}): Client | undefined {
160141export function initWithDefaultIntegrations (
161142 browserOptions : BrowserOptions = { } ,
162143 getDefaultIntegrationsImpl : ( options : BrowserOptions ) => Integration [ ] ,
144+ ) : BrowserClient | undefined {
145+ return _init ( browserOptions , getDefaultIntegrationsImpl ( browserOptions ) ) ;
146+ }
147+
148+ /**
149+ * Acutal implementation shared by init and initWithDefaultIntegrations.
150+ */
151+ function _init (
152+ browserOptions : BrowserOptions = { } ,
153+ defaultIntegrations : Integration [ ] ,
163154) : BrowserClient | undefined {
164155 const options = applyDefaultOptions ( browserOptions ) ;
165- const defaultIntegrations = getDefaultIntegrationsImpl ( browserOptions ) ;
166156
167157 const isBrowserExtension = ! options . skipBrowserExtensionCheck && shouldShowBrowserExtensionError ( ) ;
168158
169- if ( DEBUG_BUILD ) {
159+ /* if (DEBUG_BUILD) {
170160 logBrowserEnvironmentWarnings({
171161 browserExtension: isBrowserExtension,
172162 fetch: !supportsFetch(),
173163 });
174164 }
175-
165+ */
176166 if ( isBrowserExtension ) {
177167 return ;
178168 }
0 commit comments