fix: make typescript client compatible with cf workers (#3807)

* make typescript client compatible with cf workers

* Update build.sh
This commit is contained in:
Ruben Fiszel
2024-06-04 16:23:23 +02:00
committed by GitHub
parent f0da67f3b6
commit 2ca3f2e822
+4 -1
View File
@@ -8,8 +8,11 @@ npx --yes @hey-api/openapi-ts@0.43.0 --input "${script_dirpath}/../backend/wind
cat <<EOF - src/core/OpenAPI.ts > 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];