diff --git a/packages/runtime/src/global.ts b/packages/runtime/src/global.ts index 969ecb0d167..5be6ca4aed6 100644 --- a/packages/runtime/src/global.ts +++ b/packages/runtime/src/global.ts @@ -22,8 +22,14 @@ export interface Federation { __PRELOADED_MAP__: Map; } -// export const nativeGlobal: typeof global = new Function('return this')(); -export const nativeGlobal: typeof global = new Function('return this')(); +function returnGlobal() { + try { + return new Function('return this'); + } catch { + return globalThis; + } +} +export const nativeGlobal: typeof global = returnGlobal() as typeof global; export const Global = nativeGlobal; declare global {