Skip to content

Commit e665296

Browse files
authored
fix(oclite): configure React JSX for Ink TUI build (#136) (#137)
- Add explicit jsx config to Bun.build to use React - Override global tsconfig jsxImportSource (SolidJS) for oclite - Disable Log stdout printing to avoid Ink rendering conflicts - oclite (src/cli/ink) uses React/Ink, main TUI uses SolidJS Fixes: React hooks error "dispatcher.useReducer is null" Verified: 1298 tests pass, binary renders TUI successfully
1 parent 2eb4aff commit e665296

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/opencode/script/build-lite.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ async function build() {
1616
await fs.promises.mkdir(BIN, { recursive: true })
1717

1818
// Build with NODE_ENV=production to avoid devtools
19+
// Explicitly set JSX to use React for Ink components.
20+
// oclite uses React/Ink (src/cli/ink/), not SolidJS (src/cli/cmd/tui/).
21+
// This overrides the global tsconfig jsxImportSource: "@opentui/solid" setting.
1922
const result = await Bun.build({
2023
entrypoints: [path.join(ROOT, "src/cli/ink/entry.ts")],
2124
outdir: BIN,
@@ -26,6 +29,10 @@ async function build() {
2629
define: {
2730
"process.env.NODE_ENV": '"production"',
2831
},
32+
jsx: {
33+
runtime: "automatic",
34+
importSource: "react",
35+
},
2936
})
3037

3138
if (!result.success) {

‎packages/opencode/src/cli/ink/entry.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import { startInkTUI } from "./index.tsx"
99
async function main() {
1010
try {
1111
await Global.init()
12+
// Disable Log printing to stdout - Ink owns stdout for TUI rendering
1213
await Log.init({
13-
print: process.stdout.isTTY,
14+
print: false,
1415
dev: Installation.isLocal(),
1516
level: "INFO",
1617
})

0 commit comments

Comments
 (0)