From 43f36d2a0e9ce71dec9e7e5e0ef03f8f2f5763d6 Mon Sep 17 00:00:00 2001 From: imrishabh18 Date: Tue, 11 Nov 2025 21:27:55 +0530 Subject: [PATCH] Add the global polyfill --- webworker/entrypoint.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webworker/entrypoint.ts b/webworker/entrypoint.ts index 918a5034..197e737f 100644 --- a/webworker/entrypoint.ts +++ b/webworker/entrypoint.ts @@ -22,6 +22,10 @@ import { setValueAtPath } from "lib/shared/obj-path" globalThis.React = React setupFetchProxy() +// Polyfill for Node.js global object in browser workers +// Needed because @tscircuit/core and dependencies reference global.debugGraphics/debugOutputArray +globalThis.global = globalThis.global || globalThis + let executionContext: ExecutionContext | null = null let debugNamespace: string | undefined @@ -196,7 +200,7 @@ const webWorkerApi = { let element: any if (typeof component === "function") { element = component() - } else if (component && component.__isSerializedReactElement) { + } else if (component?.__isSerializedReactElement) { element = deserializeReactElement(component) } else { element = component