Pre-flight checks
OpenCode version tested
1.3.17
opencode-quota version tested
3.7.1
Bug summary
The TUI plugin fails to load on OpenCode 1.3.17 with a Bun ESM linking error. dist/lib/jsonc.js uses a named ESM import (import { parse, stringify } from "comment-json") but comment-json v5.0.0 is a CJS-only module. Bun's static ESM linker cannot resolve stringify as a named export and throws a SyntaxError at link time before the module executes.
Steps to reproduce
- Install opencode-quota per the README (server plugin + TUI plugin in
tui.json)
- Start OpenCode 1.3.17
- Observe the TUI plugin error in logs
Expected behavior
TUI plugin loads successfully; Sidebar panel and Compact status line are available.
Actual behavior
TUI plugin fails immediately on startup with:
[tui.plugin] failed to load tui plugin: Export named 'stringify' not found in module
'.../comment-json/src/index.js'.
The Sidebar panel and Compact status line are unavailable. The server plugin (slash commands, toasts) still works.
Relevant logs/output
[17:20:37] [ERROR] "[tui.plugin] failed to load tui plugin: Export named 'stringify' not found in module '/Users/tim/.cache/opencode/packages/@slkiser/opencode-quota@3.7.1/node_modules/comment-json/src/index.js'." {
path: '@slkiser/opencode-quota@3.7.1',
target: 'file:///Users/tim/.cache/opencode/packages/@slkiser/opencode-quota@3.7.1/node_modules/@slkiser/opencode-quota/dist/tui.tsx',
retry: false,
error: {
type: 'SyntaxError',
message: "Export named 'stringify' not found in module '.../comment-json/src/index.js'.",
stack: "Error: Export named 'stringify' not found in module '.../comment-json/src/index.js'.\n
at link (native)\n
at linkAndEvaluateModule (native)\n
at requestImportModule (native)\n
at processTicksAndRejections (native)"
}
}
Root cause: dist/lib/jsonc.js line 1:
import { parse, stringify } from "comment-json";
comment-json v5.0.0 uses module.exports = { stringify, ... } (no "exports" field). Bun's ESM linker does static named-export analysis and fails because stringify is assigned via const stringify = require('./stringify') — not a re-exported named binding.
Suggested fix in src/lib/jsonc.ts:
// before
import { parse, stringify } from "comment-json";
// after
import commentJson from "comment-json";
const { parse, stringify } = commentJson;
If not tested on current production OpenCode, explain why
Tested on OpenCode 1.3.17 (current release as of 2026-05-11).
Pre-flight checks
OpenCode version tested
1.3.17
opencode-quota version tested
3.7.1
Bug summary
The TUI plugin fails to load on OpenCode 1.3.17 with a Bun ESM linking error.
dist/lib/jsonc.jsuses a named ESM import (import { parse, stringify } from "comment-json") butcomment-jsonv5.0.0 is a CJS-only module. Bun's static ESM linker cannot resolvestringifyas a named export and throws aSyntaxErrorat link time before the module executes.Steps to reproduce
tui.json)Expected behavior
TUI plugin loads successfully; Sidebar panel and Compact status line are available.
Actual behavior
TUI plugin fails immediately on startup with:
The Sidebar panel and Compact status line are unavailable. The server plugin (slash commands, toasts) still works.
Relevant logs/output
Root cause:
dist/lib/jsonc.jsline 1:comment-jsonv5.0.0 usesmodule.exports = { stringify, ... }(no"exports"field). Bun's ESM linker does static named-export analysis and fails becausestringifyis assigned viaconst stringify = require('./stringify')— not a re-exported named binding.Suggested fix in
src/lib/jsonc.ts:If not tested on current production OpenCode, explain why
Tested on OpenCode 1.3.17 (current release as of 2026-05-11).