Skip to content

fix(build): stub onnxruntime-node for darwin-x64 (compile-safe)#14

Merged
katipally merged 1 commit into
mainfrom
fix-darwin-x64-stub
Jun 23, 2026
Merged

fix(build): stub onnxruntime-node for darwin-x64 (compile-safe)#14
katipally merged 1 commit into
mainfrom
fix-darwin-x64-stub

Conversation

@katipally

Copy link
Copy Markdown
Owner

Why

Follow-up to #13. That change marked onnxruntime-node external for darwin-x64, but a bun --compile standalone binary has no node_modules to resolve a runtime require, so the build failed with Cannot find package 'onnxruntime-node'.

Fix

Stub onnxruntime-node to export default {} for the darwin-x64 target only, via a Bun resolver plugin. The missing darwin/x64 .node is never reached, the binary builds, and Transformers.js falls back to its WASM backend (onnxruntime-web). The mic's guarded lazy import("@huggingface/transformers") (mic.ts, wrapped in .catch) keeps it graceful on Intel Macs.

Verified

Local cross-build of darwin-x64 now passes the bundle stage with no onnxruntime error and no "Cannot find package" (stops only at the x64 OpenTUI native lib, which is present on the real Intel runner). Typecheck + biome clean.

🤖 Generated with Claude Code

The previous `external` approach failed: a `bun --compile` standalone binary
has no node_modules to resolve a runtime require, so Bun errored at build with
"Cannot find package 'onnxruntime-node'". Stub the package to {} for darwin-x64
only via a resolver plugin — the missing darwin/x64 .node is never reached, the
binary builds, and Transformers.js falls back to its WASM backend. The mic's
guarded lazy import still degrades gracefully on Intel Macs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@katipally katipally merged commit c2ea2e8 into main Jun 23, 2026
3 checks passed
@katipally katipally deleted the fix-darwin-x64-stub branch June 23, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant