Skip to content

Commit

Permalink
Fix issue of referencing process object on browser (#778)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blurfx authored Apr 17, 2024
1 parent d02a340 commit e3ebf06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/devtools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export function setupDevtools<T, P extends Indexable>(
doc: Document<T, P>,
): 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;
}

Expand Down

0 comments on commit e3ebf06

Please sign in to comment.