File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
packages/auth/src/core/util Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @firebase/auth " : patch
3+ ---
4+
5+ Fix FetchProvider in non-browser environments, by trying to get the ` fetch ` implementation from not only ` self ` but also standard ` globalThis ` .
Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ export class FetchProvider {
4343 if ( typeof self !== 'undefined' && 'fetch' in self ) {
4444 return self . fetch ;
4545 }
46+ if ( typeof globalThis !== 'undefined' && globalThis . fetch ) {
47+ return globalThis . fetch ;
48+ }
49+ if ( typeof fetch !== 'undefined' ) {
50+ return fetch ;
51+ }
4652 debugFail (
4753 'Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
4854 ) ;
@@ -55,6 +61,12 @@ export class FetchProvider {
5561 if ( typeof self !== 'undefined' && 'Headers' in self ) {
5662 return self . Headers ;
5763 }
64+ if ( typeof globalThis !== 'undefined' && globalThis . Headers ) {
65+ return globalThis . Headers ;
66+ }
67+ if ( typeof Headers !== 'undefined' ) {
68+ return Headers ;
69+ }
5870 debugFail (
5971 'Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
6072 ) ;
@@ -67,6 +79,12 @@ export class FetchProvider {
6779 if ( typeof self !== 'undefined' && 'Response' in self ) {
6880 return self . Response ;
6981 }
82+ if ( typeof globalThis !== 'undefined' && globalThis . Response ) {
83+ return globalThis . Response ;
84+ }
85+ if ( typeof Response !== 'undefined' ) {
86+ return Response ;
87+ }
7088 debugFail (
7189 'Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
7290 ) ;
You can’t perform that action at this time.
0 commit comments