Quick Start
Bundle a file:Options
--outdir <dir>
Output directory:
--outfile <file>
Output file (single entry point):
--minify
Minify output:
--sourcemap
Generate source maps:
none, inline, external (default: external)
--target
Target runtime:
--format
Output format:
--splitting
Code splitting:
--external <packages>
External dependencies (not bundled):
--public-path
Public URL path for assets:
--conditions
Package.json export conditions:
Examples
Frontend Bundle
Library Bundle
Multiple Formats
Development vs Production
Development:Programmatic API
UseBun.build() in TypeScript:
Performance
Bun’s bundler is extremely fast:- 100x faster than Webpack
- 10x faster than esbuild
- Written in Zig for maximum performance
- Parallel processing
- Incremental compilation
Next Steps
Bundler API
Complete bundler documentation
Loaders
File type loaders
Plugins
Extend the bundler
Executables
Create standalone executables