Fix isNode detection when process module is used in webpack

Fixes #5341
This commit is contained in:
Daniel Imms
2026-01-03 11:19:23 -08:00
parent 8e4de23c11
commit 08c49301b7
+3 -1
View File
@@ -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;