From ade61a1b3f1ec5045efa131d466a5656f0db999a Mon Sep 17 00:00:00 2001 From: claygeo Date: Mon, 30 Mar 2026 11:10:13 -0400 Subject: [PATCH] fix: exclude Electron renderer from IN_NODE detection Electron exposes a full Node.js process object, including process.versions.node, which caused IN_NODE to evaluate true in Electron renderer processes. This triggered the Node.js worker/fs code path instead of the browser WASM path, crashing the renderer. Add a !process.versions.electron guard so Electron renderers are correctly treated as browser environments. Fixes: https://github.com/electric-sql/pglite/issues/813 --- packages/pglite-utils/src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pglite-utils/src/utils.ts b/packages/pglite-utils/src/utils.ts index cdbb0b5e1..06ab6452b 100644 --- a/packages/pglite-utils/src/utils.ts +++ b/packages/pglite-utils/src/utils.ts @@ -1,7 +1,8 @@ export const IN_NODE = typeof process === 'object' && typeof process.versions === 'object' && - typeof process.versions.node === 'string' + typeof process.versions.node === 'string' && + !process.versions.electron const wasmDownloadPromises = new Map>()