File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 1+ --- 
2+ ' @emotion/react ' patch 
3+ --- 
4+ 
5+ Fix error loading @emotion/react   in alternative JS environments
Original file line number Diff line number Diff line change @@ -20,7 +20,14 @@ if (process.env.NODE_ENV !== 'production') {
2020  const  isJest  =  typeof  jest  !==  'undefined' 
2121
2222  if  ( isBrowser  &&  ! isJest )  { 
23-     const  globalContext  =  isBrowser  ? window  : global 
23+     // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later 
24+     const  globalContext  = 
25+       // $FlowIgnore 
26+       typeof  globalThis  !==  'undefined' 
27+         ? globalThis  // eslint-disable-line no-undef 
28+         : isBrowser 
29+         ? window 
30+         : global 
2431    const  globalKey  =  `__EMOTION_REACT_${ pkg . version . split ( '.' ) [ 0 ] }  
2532    if  ( globalContext [ globalKey ] )  { 
2633      console . warn ( 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments