Skip to content

predev.ts: Bun baseline runtime download fails behind some networks; fall back to local bun #25562

@zoulukuang

Description

@zoulukuang

Symptoms

packages/desktop/scripts/predev.ts (invoked by Tauri''s beforeDevCommand and beforeBuildCommand) downloads the Bun baseline runtime (opencode-windows-x64-baseline.exe etc., ~190 MB) from GitHub releases on first build. In China and some restricted networks, GitHub release downloads are slow or fail entirely (TLS reset, partial download, etc.). Build halts with no useful fallback path.

Why baseline matters

The baseline build targets older CPUs without AVX2. For local dev where the developer''s machine almost certainly has AVX2 (any 2013+ Intel / 2017+ AMD), the regular Bun runtime that''s already installed is sufficient.

Proposal

In predev.ts:

  1. Detect the locally installed bun in PATH and check if it can produce a single-file binary at the desired target.
  2. If yes, run bun build --single against packages/opencode to emit a sidecar binary using the local runtime. This avoids the baseline download entirely on dev machines.
  3. Only fall back to the GitHub download when local bun is missing or the target architecture genuinely needs baseline (e.g. CI building release artifacts for distribution).

This is what we did in our fork''s build-deskfox.ps1 (downstream of predev.ts), and it works reliably on Windows behind restricted networks — the local bun is already installed via packageManager: bun@1.3.13, so bun build --single just works.

Workaround for affected users today

Set HTTP_PROXY / HTTPS_PROXY to a working proxy before bun dev. Or manually drop a baseline binary at the expected sidecar path.

Happy to draft a PR if upstream agrees this is the right direction.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions