From e3ebf068c1255fe26adc75ef3b2bbcf80fe6b63f Mon Sep 17 00:00:00 2001 From: changhui lee Date: Thu, 18 Apr 2024 01:55:48 +0900 Subject: [PATCH] Fix issue of referencing process object on browser (#778) This commit does type-check first to avoid referencing the process object to prevent type issues when using the yorkie-js-sdk in a web browser via a CDN, etc. --- src/devtools/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/devtools/index.ts b/src/devtools/index.ts index 62e548c10..6d67e6f8f 100644 --- a/src/devtools/index.ts +++ b/src/devtools/index.ts @@ -99,7 +99,10 @@ export function setupDevtools( doc: Document, ): void { // NOTE(hackerwins): For production builds, or when running in Node.js, do nothing. - if (process.env.NODE_ENV === 'production' || typeof window === 'undefined') { + if ( + (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') || + typeof window === 'undefined' + ) { return; }