From 2ca3f2e822ab3691a603da4a75a78210acdf620f Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 4 Jun 2024 16:23:23 +0200 Subject: [PATCH] fix: make typescript client compatible with cf workers (#3807) * make typescript client compatible with cf workers * Update build.sh --- typescript-client/build.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typescript-client/build.sh b/typescript-client/build.sh index 3b6dec9c41..4bbe20c649 100755 --- a/typescript-client/build.sh +++ b/typescript-client/build.sh @@ -8,8 +8,11 @@ npx --yes @hey-api/openapi-ts@0.43.0 --input "${script_dirpath}/../backend/wind cat < temp_file && mv temp_file src/core/OpenAPI.ts const getEnv = (key: string) => { if (typeof window === "undefined") { + if (typeof process !== "undefined") { + return process?.env?.[key]; + } // node - return process?.env?.[key]; + return globalThis?.process?.env?.[key]; } // browser return window?.process?.env?.[key];