diff --git a/src/call_builder.ts b/src/call_builder.ts index 1eafe533b..88b490500 100644 --- a/src/call_builder.ts +++ b/src/call_builder.ts @@ -23,7 +23,7 @@ const anyGlobal = global as any; type Constructable = new (e: string) => T; // require("eventsource") for Node and React Native environment let EventSource: Constructable = anyGlobal.EventSource ?? - anyGlobal.window.EventSource ?? + anyGlobal.window?.EventSource ?? require("eventsource"); /**