@@ -312,20 +312,8 @@ export function generateGlobalInjectorCode({
312312 release : string ;
313313 injectBuildInformation : boolean ;
314314} ) {
315- // The code below is mostly ternary operators because it saves bundle size.
316- // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
317315 let code = `{
318- const _global =
319- typeof window !== 'undefined' ?
320- window :
321- typeof global !== 'undefined' ?
322- global :
323- typeof globalThis !== 'undefined' ?
324- globalThis :
325- typeof self !== 'undefined' ?
326- self :
327- {};
328-
316+ let _global = globalThis;
329317 _global.SENTRY_RELEASE={id:${ JSON . stringify ( release ) } };` ;
330318
331319 if ( injectBuildInformation ) {
@@ -342,20 +330,9 @@ export function generateGlobalInjectorCode({
342330
343331// eslint-disable-next-line @typescript-eslint/no-explicit-any
344332export function generateModuleMetadataInjectorCode ( metadata : any ) {
345- // The code below is mostly ternary operators because it saves bundle size.
346- // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
347333 // We are merging the metadata objects in case modules are bundled twice with the plugin
348334 return `{
349- const _sentryModuleMetadataGlobal =
350- typeof window !== "undefined"
351- ? window
352- : typeof global !== "undefined"
353- ? global
354- : typeof globalThis !== "undefined"
355- ? globalThis
356- : typeof self !== "undefined"
357- ? self
358- : {};
335+ let _sentryModuleMetadataGlobal = globalThis;
359336
360337 _sentryModuleMetadataGlobal._sentryModuleMetadata =
361338 _sentryModuleMetadataGlobal._sentryModuleMetadata || {};
0 commit comments