Skip to content

Commit

Permalink
fix: check process is defined when using the proxy (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-elicx committed Nov 1, 2023
1 parent 963e083 commit d2cc335
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-shrimps-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'cf-bindings-proxy': patch
---

Check process is not undefined when checking whether to use the binding or not.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d2cc335

Please sign in to comment.