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