--bytecode flag — pre-compile JS to JSC bytecode at build
bun build --bytecode pre-compiles JS to JavaScriptCore bytecode and embeds it in the bundle. Cuts parse time at startup.
Summary
bun build --bytecode pre-compiles JS to JavaScriptCore bytecode and embeds it in the bundle. Cuts parse time at startup.
Why backlog
Patties build spec doesn't expose --bytecode today. There's no measured cold-start issue that justifies the added pipeline complexity.
Trigger to promote to draft
- Edge adapter cold-start benchmarks show JS parse time as ≥ 20% of startup, OR
- Single-binary deploy (
--compile) latency-sensitive use case.
Bun-unique classification
Bun-only — as a user-facing build-time flag this doesn't exist on Node. Next.js can't ship the equivalent because V8 doesn't expose it that way.
Open questions when promoted
- Source maps interaction — does
--bytecoderetain SourceMappingURL? - Per-target opt-in (bun adapter on, edge adapter off when target runtime doesn't support JSC bytecode) — likely Bun-target only.
- Build-time cost vs runtime savings — measure before claiming.