@@ -127,26 +127,7 @@ declare const __SENTRY_RELEASE__: string | undefined;
127
127
* @see {@link BrowserOptions } for documentation on configuration options.
128
128
*/
129
129
export 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 ) ) ;
150
131
}
151
132
152
133
/**
@@ -160,19 +141,28 @@ export function init(browserOptions: BrowserOptions = {}): Client | undefined {
160
141
export function initWithDefaultIntegrations (
161
142
browserOptions : BrowserOptions = { } ,
162
143
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 [ ] ,
163
154
) : BrowserClient | undefined {
164
155
const options = applyDefaultOptions ( browserOptions ) ;
165
- const defaultIntegrations = getDefaultIntegrationsImpl ( browserOptions ) ;
166
156
167
157
const isBrowserExtension = ! options . skipBrowserExtensionCheck && shouldShowBrowserExtensionError ( ) ;
168
158
169
- if ( DEBUG_BUILD ) {
159
+ /* if (DEBUG_BUILD) {
170
160
logBrowserEnvironmentWarnings({
171
161
browserExtension: isBrowserExtension,
172
162
fetch: !supportsFetch(),
173
163
});
174
164
}
175
-
165
+ */
176
166
if ( isBrowserExtension ) {
177
167
return ;
178
168
}
0 commit comments