You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--platform bun does not select a package's bun export condition — the node entry is compiled instead #10281
--platform bun does not select the bun entry of a package whose exports offers one. Perry's condition list has no bun entry at all and ranks node first, so a package that ships both compiles its node build even when the target is bun. When the two entries are different implementations rather than cosmetic variants, the compiled program runs a different backend than the bun binary it is meant to match.
Where
crates/perry/src/commands/compile/resolve.rs and resolve/subpath_imports.rs both carry the same list:
resolve_exports, resolve_exports_candidates and resolve_subpath_import all use it, and their comments already require the three to agree. Nothing consults CompilationContext::bun_platform, which is set from --platform bun in run_pipeline.rs.
There is one existing exception: resolve/solid.rs hard-codes ["bun", "node", "import", "default"], which is why @opentui/solid resolves its bun entry while its sibling does not.
The two entries load different renderer backends. OpenCode's terminal interface dies under perry with TypeError: value is not a function during the dynamic import of its TUI layer, while the official bun-compiled binary starts normally. The nameless message is expected here: the failing call is indirect, so the runtime has no callee name to report.
A module-body trace over the whole subgraph (entry and exit markers in all 152 TUI-package modules plus the OpenTUI packages, compared against the same trace under bun) shows the divergence directly. Bun initializes:
@opentui/core/chunk-bun-t2myhmwd.js ← bun entry
@opentui/solid/index.bun.js
… 136 modules, all balanced, import succeeds
perry initializes:
@opentui/core/chunk-node-q0cwyvm9.js ← node entry
@opentui/core/chunk-node-51kpf0mz.js
@opentui/core/index.node.js
@opentui/solid/index.bun.js ← bun entry, via the solid special case
… 15 modules, then the throw
Note the inconsistency inside one program: the core package resolves node, the solid package resolves bun.
Expected
Bun resolves with ["bun", "node", …]. Under --platform bun, perry should too, so the compiled program runs the same files. Keep bun below perry so an explicit perry entry still wins, and change nothing for other targets.
Acceptance
With --platform bun, a package exporting { bun, node } resolves its bun entry; without it, the node entry, as today.
The three resolvers read one shared list so they cannot drift apart.
A regression test covering both directions.
OpenCode's @opentui/core resolves index.bun.js in a full collect of the v1.18.30 graph.
Fix in PR #10283: bun ranks directly after perry and above node only when the target is bun, and the three resolvers now read one shared accessor. A full collect of the OpenCode v1.18.30 graph with the fixed compiler resolves @opentui/core/index.bun.js. The regression test covers both directions and is shown failing when the accessor is forced back to the node list.
Activity
test(resolve): pin the bun export condition in both directions (Perry…
proggeramlug commentedon Sep 15, 2026
Fix in PR #10283:
bunranks directly afterperryand abovenodeonly when the target is bun, and the three resolvers now read one shared accessor. A full collect of the OpenCode v1.18.30 graph with the fixed compiler resolves@opentui/core/index.bun.js. The regression test covers both directions and is shown failing when the accessor is forced back to the node list.test(resolve): pin the bun export condition in both directions (#10281)