From 08c49301b7d5a3cca9fbf2dc468e456e725f6455 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 3 Jan 2026 11:19:23 -0800 Subject: [PATCH 1/3] Fix isNode detection when process module is used in webpack Fixes #5341 --- src/common/Platform.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index 4102f20c..7ea0e9c6 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -14,7 +14,9 @@ interface INavigator { declare const navigator: INavigator; declare const process: unknown; -export const isNode = (typeof process !== 'undefined' && 'title' in (process as any)) ? true : false; +// navigator is also checked here because bundling with the process module can cause issues +// otherwise +export const isNode = (typeof process !== 'undefined' && 'title' in (process as any) && typeof navigator === 'undefined') ? true : false; const userAgent = (isNode) ? 'node' : navigator.userAgent; const platform = (isNode) ? 'node' : navigator.platform; From e2f45b5f4ee64bc6e50061d0169329f0f12a79ad Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 3 Jan 2026 14:10:44 -0800 Subject: [PATCH 2/3] Fix for modern node that includes a navigator.userAgent --- src/common/Platform.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index 7ea0e9c6..7cfb9f87 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -14,9 +14,9 @@ interface INavigator { declare const navigator: INavigator; declare const process: unknown; -// navigator is also checked here because bundling with the process module can cause issues -// otherwise -export const isNode = (typeof process !== 'undefined' && 'title' in (process as any) && typeof navigator === 'undefined') ? true : false; +// navigator.userAgent is also checked here because bundling with the process module can cause +// issues otherwise. Note that navigator exists in Node.js 21+ but the userAgent is "Node.js/". +export const isNode = (typeof process !== 'undefined' && 'title' in (process as any) && (typeof navigator === 'undefined' || navigator.userAgent.startsWith('Node.js/'))) ? true : false; const userAgent = (isNode) ? 'node' : navigator.userAgent; const platform = (isNode) ? 'node' : navigator.platform; From d7850af9a2db27adda9f1f4bd2973292417739bd Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 3 Jan 2026 14:19:36 -0800 Subject: [PATCH 3/3] Fix lint --- src/common/Platform.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index 7cfb9f87..ec34acde 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -15,7 +15,8 @@ declare const navigator: INavigator; declare const process: unknown; // navigator.userAgent is also checked here because bundling with the process module can cause -// issues otherwise. Note that navigator exists in Node.js 21+ but the userAgent is "Node.js/". +// issues otherwise. Note that navigator exists in Node.js 21+ but the userAgent is +// "Node.js/". export const isNode = (typeof process !== 'undefined' && 'title' in (process as any) && (typeof navigator === 'undefined' || navigator.userAgent.startsWith('Node.js/'))) ? true : false; const userAgent = (isNode) ? 'node' : navigator.userAgent; const platform = (isNode) ? 'node' : navigator.platform;