Skip to content

Commit e0680da

Browse files
deepjyoti30-stporcellus
authored andcommitted
fix: handle navigator being undefined while checking CF runtime
1 parent db43f16 commit e0680da

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/build/utils.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const doFetch: typeof fetch = async (input: RequestInfo | URL, init?: Req
5454
};
5555

5656
function isRunningInCloudflareWorker() {
57-
return navigator.userAgent === "Cloudflare-Workers";
57+
return typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers";
5858
}
5959

6060
export function getLargestVersionFromIntersection(v1: string[], v2: string[]): string | undefined {

0 commit comments

Comments
 (0)