Skip to content

Commit 46d7ca1

Browse files
authored
fix(bun): reinstall plugins when cache module missing (anomalyco#8815)
1 parent e660ff4 commit 46d7ca1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/opencode/src/bun/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import z from "zod"
22
import { Global } from "../global"
33
import { Log } from "../util/log"
44
import path from "path"
5+
import { Filesystem } from "../util/filesystem"
56
import { NamedError } from "@opencode-ai/util/error"
67
import { readableStreamToText } from "bun"
78
import { createRequire } from "module"
@@ -71,7 +72,10 @@ export namespace BunProc {
7172
await Bun.write(pkgjson.name!, JSON.stringify(result, null, 2))
7273
return result
7374
})
74-
if (parsed.dependencies[pkg] === version) return mod
75+
const dependencies = parsed.dependencies ?? {}
76+
if (!parsed.dependencies) parsed.dependencies = dependencies
77+
const modExists = await Filesystem.exists(mod)
78+
if (dependencies[pkg] === version && modExists) return mod
7579

7680
const proxied = !!(
7781
process.env.HTTP_PROXY ||

0 commit comments

Comments
 (0)