From dd99b7ee234f8c37ea3916a9f02d29a1a2c78a13 Mon Sep 17 00:00:00 2001 From: johnfabre <49779476+johnfabre@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:12:42 +0800 Subject: [PATCH] Use optional chaining when retrieving NODE_ENV this will fix the issue where globalThis.process.env is undefined and it is still trying to retrieve NODE_ENV --- src/jsutils/instanceOf.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsutils/instanceOf.ts b/src/jsutils/instanceOf.ts index c84bcb2afc..90171a71cc 100644 --- a/src/jsutils/instanceOf.ts +++ b/src/jsutils/instanceOf.ts @@ -9,7 +9,7 @@ import { inspect } from './inspect.js'; export const instanceOf: (value: unknown, constructor: Constructor) => boolean = /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 - globalThis.process != null && globalThis.process.env.NODE_ENV === 'production' + globalThis.process != null && globalThis.process.env != null && globalThis.process.env.NODE_ENV === 'production' ? function instanceOf(value: unknown, constructor: Constructor): boolean { return value instanceof constructor; }