diff --git a/lib/globalThis.browser.ts b/lib/globalThis.browser.ts index ea8c4c431..0962057d1 100644 --- a/lib/globalThis.browser.ts +++ b/lib/globalThis.browser.ts @@ -1,4 +1,4 @@ -export default (() => { +export const globalThisShim = (() => { if (typeof self !== "undefined") { return self; } else if (typeof window !== "undefined") { diff --git a/lib/globalThis.ts b/lib/globalThis.ts index 1b8c4b29a..27a616bd4 100644 --- a/lib/globalThis.ts +++ b/lib/globalThis.ts @@ -1 +1 @@ -export default global; +export const globalThisShim = global; diff --git a/lib/transports/polling.ts b/lib/transports/polling.ts index 78f5e28ce..93e4ace4f 100644 --- a/lib/transports/polling.ts +++ b/lib/transports/polling.ts @@ -7,7 +7,7 @@ import XMLHttpRequest from "./xmlhttprequest.js"; import { Emitter } from "@socket.io/component-emitter"; import { SocketOptions } from "../socket.js"; import { installTimerFunctions, pick } from "../util.js"; -import globalThis from "../globalThis.js"; +import { globalThisShim as globalThis } from "../globalThis.js"; const debug = debugModule("engine.io-client:polling"); // debug() diff --git a/lib/transports/websocket-constructor.browser.ts b/lib/transports/websocket-constructor.browser.ts index 023d953d8..f103edf9b 100644 --- a/lib/transports/websocket-constructor.browser.ts +++ b/lib/transports/websocket-constructor.browser.ts @@ -1,4 +1,4 @@ -import globalThis from "../globalThis.js"; +import { globalThisShim as globalThis } from "../globalThis.js"; export const nextTick = (() => { const isPromiseAvailable = diff --git a/lib/transports/xmlhttprequest.browser.ts b/lib/transports/xmlhttprequest.browser.ts index ec71b40ad..db6846b2c 100644 --- a/lib/transports/xmlhttprequest.browser.ts +++ b/lib/transports/xmlhttprequest.browser.ts @@ -1,7 +1,7 @@ // browser shim for xmlhttprequest module import { hasCORS } from "../contrib/has-cors.js"; -import globalThis from "../globalThis.js"; +import { globalThisShim as globalThis } from "../globalThis.js"; export default function(opts) { const xdomain = opts.xdomain; diff --git a/lib/util.ts b/lib/util.ts index 4e40d4e36..48e927eeb 100644 --- a/lib/util.ts +++ b/lib/util.ts @@ -1,4 +1,4 @@ -import globalThis from "./globalThis.js"; +import { globalThisShim as globalThis } from "./globalThis.js"; export function pick(obj, ...attr) { return attr.reduce((acc, k) => { diff --git a/lib/xmlhttprequest.ts b/lib/xmlhttprequest.ts index 660d4135b..b1e803d41 100644 --- a/lib/xmlhttprequest.ts +++ b/lib/xmlhttprequest.ts @@ -1,7 +1,7 @@ // browser shim for xmlhttprequest module import { hasCORS } from "./contrib/has-cors.js"; -import globalThis from "./globalThis.js"; +import { globalThisShim as globalThis } from "./globalThis.js"; export default function(opts) { const xdomain = opts.xdomain;