Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(desktop): resolve electron-vite bin via PATH in dev script (#4992)

YYClaw12d901638ec9
diff --git a/apps/desktop/scripts/dev.mjs b/apps/desktop/scripts/dev.mjs
index 23df24ada1..022d489577 100644
--- a/apps/desktop/scripts/dev.mjs
+++ b/apps/desktop/scripts/dev.mjs
@@ -13,6 +13,7 @@ import { spawnSync } from "node:child_process";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
+import { envWithLocalBins } from "./package.mjs";
import {
applyWorktreeDevEnv,
repoRootFromScriptDir,
@@ -25,10 +26,10 @@ applyWorktreeDevEnv(process.env, {
log: true,
});
-function run(command, args, { shell = false } = {}) {
+function run(command, args, { shell = false, env = process.env } = {}) {
const result = spawnSync(command, args, {
stdio: "inherit",
- env: process.env,
+ env,
shell,
});
if (result.error) {
@@ -43,11 +44,10 @@ run(node, [join(here, "bundle-cli.mjs")]);
run(node, [join(here, "brand-dev-electron.mjs")]);
const isWin = process.platform === "win32";
-const electronVite = join(
- here,
- "..",
- "node_modules",
- ".bin",
- isWin ? "electron-vite.cmd" : "electron-vite",
-);
-run(electronVite, ["dev", ...process.argv.slice(2)], { shell: isWin });
+// electron-vite's bin lands in apps/desktop/node_modules/.bin under the
+// isolated linker but only in the repo-root .bin under the hoisted linker
+// (.npmrc node-linker=hoisted); envWithLocalBins puts both on PATH.
+run("electron-vite", ["dev", ...process.argv.slice(2)], {
+ shell: isWin,
+ env: envWithLocalBins(process.env),
+});