Skip to main content
Bun’s fast native bundler can be used via the bun build CLI command or the Bun.build() JavaScript API.

At a Glance

  • JS API: await Bun.build({ entrypoints, outdir })
  • CLI: bun build <entry> --outdir ./out
  • Watch: --watch for incremental rebuilds
  • Targets: --target browser|bun|node
  • Formats: --format esm|cjs|iife (experimental for cjs/iife)
https://mintcdn.com/bun-1dd33a4e/Hq64iapoQXHbYMEN/icons/typescript.svg?fit=max&auto=format&n=Hq64iapoQXHbYMEN&q=85&s=c6cceedec8f82d2cc803d7c6ec82b240build.ts
await Bun.build({
  entrypoints: ['./index.tsx'],
  outdir: './build',
});
It’s fast. The numbers below represent performance on esbuild’s three.js benchmark.