From 0ca4a26cdd6735e1c2b3264a9f62fd905d8e2454 Mon Sep 17 00:00:00 2001 From: Denys Oblohin Date: Thu, 9 Jan 2025 17:10:44 +0200 Subject: [PATCH] Fix issue with process global (#1166) * fix process * chlog --- CHANGELOG.md | 2 ++ packages/core/modules/utils/stuff.js | 4 ++-- packages/ui/modules/utils/stuff.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe123316..bf22d31a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Changelog +- 6.6.6 + - Fix issue with process global (PR #1166) (issue #1165) - 6.6.5 - Support import fom SQL (`SqlUtils.loadFromSql`) (PR #1103) (issue #911, #593) - Fixed type issue with SerializedFunction (PR #1103) (issue #1024) diff --git a/packages/core/modules/utils/stuff.js b/packages/core/modules/utils/stuff.js index 3b92075ec..f6647d706 100644 --- a/packages/core/modules/utils/stuff.js +++ b/packages/core/modules/utils/stuff.js @@ -521,8 +521,8 @@ export const isJsonCompatible = (tpl, obj, bag = {}, path = []) => { } }; -const isDev = () => (process?.env?.NODE_ENV == "development"); -const isTest = () => (process?.env?.NODE_ENV_TEST == "true"); +const isDev = () => (typeof process !== "undefined" && process?.env?.NODE_ENV == "development"); +const isTest = () => (typeof process !== "undefined" && process?.env?.NODE_ENV_TEST == "true"); export const getLogger = (devMode) => { if (isTest()) { diff --git a/packages/ui/modules/utils/stuff.js b/packages/ui/modules/utils/stuff.js index b4da25770..52d565e9a 100644 --- a/packages/ui/modules/utils/stuff.js +++ b/packages/ui/modules/utils/stuff.js @@ -97,8 +97,8 @@ function shallowEqualObjects(objA, objB, deep = false) { } -const isDev = () => (process?.env?.NODE_ENV == "development"); -const isTest = () => (process?.env?.NODE_ENV_TEST == "true"); +const isDev = () => (typeof process !== "undefined" && process?.env?.NODE_ENV == "development"); +const isTest = () => (typeof process !== "undefined" && process?.env?.NODE_ENV_TEST == "true"); export const getLogger = (devMode) => { if (isTest()) {