fix(desktop): unpack the full node_modules tree for the WSL backend

The WSL backend launches the server with the distro's own Linux Node, which
can't read inside app.asar. asarUnpack only covered the server bundle and
node-pty, but bin.mjs externalizes its runtime dependencies (effect, @effect/*,
...) to node_modules rather than inlining them. So the Linux Node crashed with
ERR_MODULE_NOT_FOUND ("Cannot find package 'effect'") before it even reached
node-pty, which left WSL-only mode unable to launch (the node-pty preflight had
already passed, so there was no Windows fallback).

Unpack the whole node_modules tree so every server import resolves on the real
filesystem. The Windows primary keeps reading the same files through the asar
via ELECTRON_RUN_AS_NODE, so there's no duplication.
This commit is contained in:
Josh Gratton committed 2026-06-12 14:22:24 -04:00
1 parent 185032bd17
commit bbb7ba7b07
1 file changed
+10 -5
+10 -5
View File
@@ -711,11 +711,16 @@ const createBuildConfig = Effect.fn("createBuildConfig")(function* (
// The Windows primary backend runs the server bundle through
// ELECTRON_RUN_AS_NODE (asar-aware), so it reads bin.mjs straight out of
// app.asar. The WSL backend instead launches plain `wsl.exe -- node`, which
// cannot read inside an asar archive — it needs the server bundle and
// node-pty on the real filesystem. Unpack both to app.asar.unpacked (the
// Windows primary's asar reads are transparently redirected to the same
// unpacked copy, so there's no duplication).
asarUnpack: ["apps/server/dist/**", "**/node_modules/node-pty/**/*"],
// cannot read inside an asar archive, so everything it loads must be on the
// real filesystem. The server bundle externalizes its runtime dependencies
// (effect, @effect/*, node-pty, ...) to node_modules rather than inlining
// them, so unpacking just the bundle + node-pty isn't enough — the Linux Node
// fails with ERR_MODULE_NOT_FOUND (e.g. "Cannot find package 'effect'") before
// it even reaches node-pty. Unpack the server bundle AND the whole
// node_modules tree so every import resolves. The Windows primary keeps
// reading the same files through the asar (transparently redirected to the
// unpacked copy), so there's no duplication.
asarUnpack: ["apps/server/dist/**", "**/node_modules/**"],
};
const updateChannel = resolveDesktopUpdateChannel(version);
const publishConfig = resolveGitHubPublishConfig(updateChannel);