Skip to content

Commit bdce39d

Browse files
authored
fix: global-scope reference error in nodejs (#474)
1 parent aeed7bb commit bdce39d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/global-scope.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
1-
const GlobalScope = typeof window !== 'undefined' ? window : self;
1+
/* global globalThis */
2+
const GlobalScope = (() => {
3+
if (typeof globalThis !== 'undefined') {
4+
return globalThis;
5+
}
6+
if (typeof window !== 'undefined') {
7+
return window;
8+
}
9+
if (typeof self !== 'undefined') {
10+
return self;
11+
}
12+
if (typeof global !== 'undefined') {
13+
return global;
14+
}
15+
})();
16+
217
export default GlobalScope;

0 commit comments

Comments
 (0)