diff --git a/packages/utils/src/globalThis.ts b/packages/utils/src/globalThis.ts index 31378c5dee0..99af5ea3b72 100644 --- a/packages/utils/src/globalThis.ts +++ b/packages/utils/src/globalThis.ts @@ -1,2 +1,13 @@ -export const globalThisPolyfill = - self || window || global || Function('return this')() +function globalThis() { + if (typeof self !== 'undefined') { + return self + } + if (typeof window !== 'undefined') { + return window + } + if (typeof global !== 'undefined') { + return global + } + return Function('return this')() +} +export const globalThisPolyfill = globalThis()