From b83c59bb43ad14ac932cd0c662f7dfc2c4c62753 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Tue, 24 Nov 2020 14:53:08 +0100 Subject: [PATCH] fix: handle globalThis undefined in legacy browsers --- src/runtime/browser/global.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/browser/global.ts b/src/runtime/browser/global.ts index 3e36e614..8f9f21b5 100644 --- a/src/runtime/browser/global.ts +++ b/src/runtime/browser/global.ts @@ -1,9 +1,10 @@ /* eslint-disable no-restricted-globals */ function getGlobal() { + if (typeof globalThis !== 'undefined') return globalThis if (typeof self !== 'undefined') return self if (typeof window !== 'undefined') return window throw new Error('unable to locate global object') } -export default globalThis || getGlobal() +export default getGlobal()