Skip to content

Commit 393798a

Browse files
committed
fix(desktop): bundle core in packaged app
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1fc19188-72f7-45c9-9cb3-fc3aad38a17c
1 parent 356a001 commit 393798a

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

packages/desktop/electron.vite.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const require = __cjs_mod__.createRequire(import.meta.url);
3333
`,
3434
},
3535
},
36-
externalizeDeps: { include: [nodePtyPkg] },
36+
// Core publishes TypeScript source exports for Bun consumers. Bundle it so
37+
// packaged Electron never asks Node to strip types inside node_modules.
38+
externalizeDeps: { exclude: ["@opencode-ai/core"], include: [nodePtyPkg] },
3739
},
3840
plugins: [
3941
{

packages/desktop/src/renderer/html.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ describe("electron vite publicDir", () => {
6060
expect(existsSync(join(resolved, "oc-theme-preload.js"))).toBe(true)
6161
})
6262
})
63+
64+
describe("electron vite main bundle", () => {
65+
test("bundles workspace core instead of loading TypeScript from node_modules", async () => {
66+
const config = await Bun.file(join(root, "electron.vite.config.ts")).text()
67+
expect(config).toMatch(/externalizeDeps:\s*\{[^}]*exclude:\s*\[\s*["']@opencode-ai\/core["']/s)
68+
})
69+
})

0 commit comments

Comments
 (0)