From a89e6940c0cf8fb1f97296c4340be9b17f6b04d5 Mon Sep 17 00:00:00 2001 From: southseact-3d Date: Tue, 10 Feb 2026 12:21:38 +0000 Subject: [PATCH] Fix: Resolve @opentui/core from various node_modules locations --- opencode/packages/opencode/script/build.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/opencode/packages/opencode/script/build.ts b/opencode/packages/opencode/script/build.ts index b55f04d..3ef5862 100755 --- a/opencode/packages/opencode/script/build.ts +++ b/opencode/packages/opencode/script/build.ts @@ -130,7 +130,22 @@ for (const item of targets) { console.log(`building ${name}`) await $`mkdir -p dist/${name}/bin` - const parserWorker = fs.realpathSync(path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js")) + const parserWorker = await (async () => { + // Try to resolve from various possible locations (handles both hoisted and non-hoisted installs) + const possiblePaths = [ + path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js"), + path.resolve(dir, "../../node_modules/@opentui/core/parser.worker.js"), + path.resolve(dir, "../../../node_modules/@opentui/core/parser.worker.js"), + ] + for (const p of possiblePaths) { + try { + return fs.realpathSync(p) + } catch { + continue + } + } + throw new Error("Could not find @opentui/core/parser.worker.js in any node_modules location") + })() const workerPath = "./src/cli/cmd/tui/worker.ts" // Use platform-specific bunfs root path based on target OS