bun build in Bun
From the Bun cheat sheet · Bundler · verified Jul 2026
bun build
Bundle code for browsers and servers
bash
# CLI bundling
bun build ./src/index.ts --outdir ./dist
bun build ./src/index.ts --outdir ./dist --minify
bun build ./src/index.ts --target browser💡 bun build replaces Webpack/esbuild — native bundling with zero config
⚡ Use --compile to create a single executable binary that runs without Bun installed
📌 --target browser strips Node.js APIs; --target bun optimizes for the Bun runtime
🟢 Code splitting with --splitting creates shared chunks for multi-entry bundles
buildbundlecompile