Skip to content

The agent that grows with you

fix(desktop): restore the ESM __dirname shim in vite.config.ts

ethernet3a6124389aa1
diff --git a/apps/desktop/vite.config.ts b/apps/desktop/vite.config.ts
index 28ca0d797ab..d5aae0d2489 100644
--- a/apps/desktop/vite.config.ts
+++ b/apps/desktop/vite.config.ts
@@ -17,9 +17,13 @@ function compilerPreset() {
import fs from 'fs'
import { createRequire } from 'module'
import path from 'path'
+import { fileURLToPath } from 'url'
import tailwindcss from '@tailwindcss/vite'
+// The runner loads this as ESM without the default bundler's CJS globals.
+const __dirname: string = path.dirname(fileURLToPath(import.meta.url))
+
// `hgui` symlinks a worktree's node_modules to the main checkout. Vite realpaths
// those before enforcing server.fs.allow, so codicon/font assets resolve outside
// the worktree root and 404. Whitelist the real node_modules locations.