From 0fc265b3878769fab9656ffd7ddfa6d53f496a8e Mon Sep 17 00:00:00 2001 From: James Date: Wed, 1 Nov 2023 10:02:42 +0000 Subject: [PATCH] fix: check process is defined when using the proxy --- .changeset/unlucky-shrimps-laugh.md | 5 +++++ src/index.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/unlucky-shrimps-laugh.md diff --git a/.changeset/unlucky-shrimps-laugh.md b/.changeset/unlucky-shrimps-laugh.md new file mode 100644 index 0000000..3fcae65 --- /dev/null +++ b/.changeset/unlucky-shrimps-laugh.md @@ -0,0 +1,5 @@ +--- +'cf-bindings-proxy': patch +--- + +Check process is not undefined when checking whether to use the binding or not. diff --git a/src/index.ts b/src/index.ts index 1130167..47fdcae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,8 +11,9 @@ import { createBindingProxy } from './proxy'; * `true`. * */ export const isProxyEnabled = () => - process?.env?.ENABLE_BINDINGS_PROXY || - (!process?.env?.DISABLE_BINDINGS_PROXY && process?.env?.NODE_ENV === 'development'); + typeof process !== 'undefined' && + (process?.env?.ENABLE_BINDINGS_PROXY || + (!process?.env?.DISABLE_BINDINGS_PROXY && process?.env?.NODE_ENV === 'development')); /** * Interfaces with a binding from the environment.