esbuild — Extremely Fast JavaScript Bundler
esbuild is an extremely fast JavaScript/TypeScript bundler written in Go. 10-100x faster than webpack/Rollup. Powers Vite, Bun, and many modern build tools as their underlying transform engine.
Ready-to-run agent install
This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.
npx -y tokrepo@latest install ee954487-3577-11f1-9bc6-00163e2b0d79 --target codexRun after dry-run confirms the install plan.
What it is
esbuild is an extremely fast JavaScript and TypeScript bundler written in Go by Evan Wallace (Figma co-founder). It bundles, minifies, tree-shakes, and generates source maps for modern web projects at speeds that are 10-100x faster than traditional JavaScript-based bundlers.
The tool serves frontend developers, library authors, and build-tool maintainers. It powers Vite, Bun, and other modern tools as their underlying transform engine.
How it saves time or tokens
esbuild transforms the three.js codebase (10,000+ modules) in approximately 0.3 seconds compared to 35 seconds for webpack. This speed comes from Go's native parallelism, shared memory, and zero-copy parsing. Faster builds mean shorter feedback loops during development and faster CI pipelines.
How to use
- Install esbuild with
npm i -D esbuild. - Run the CLI to bundle your entry point:
npx esbuild src/app.ts --bundle --outfile=dist/app.js. - Add flags for your target environment:
--platform=browser --target=es2020 --minify --sourcemap.
Example
import { build } from 'esbuild';
await build({
entryPoints: ['src/app.ts'],
bundle: true,
outfile: 'dist/app.js',
platform: 'browser',
target: 'es2020',
minify: true,
sourcemap: true,
});
Related on TokRepo
- AI Tools for Coding -- development tools that accelerate your workflow
- Featured Workflows -- discover popular developer tools and configurations
Common pitfalls
- esbuild strips TypeScript types but does not run type checking. Pair it with
tsc --noEmitin your CI pipeline for type safety. - The plugin API is powerful but limited compared to webpack's loader ecosystem. Check plugin compatibility before migrating complex setups.
- Code splitting with esbuild requires
format: 'esm'. CommonJS output does not support dynamicimport()splitting.
Frequently Asked Questions
esbuild is written in Go, which compiles to native code with true parallelism via goroutines. It parses, links, and generates code in parallel across CPU cores. JavaScript bundlers like webpack run single-threaded in Node.js and pay overhead for garbage collection and dynamic typing.
For many projects, yes. esbuild handles bundling, minification, TypeScript, JSX, and tree shaking. However, projects relying on webpack-specific loaders (e.g., CSS modules with postcss-loader) or HMR may need Vite (which uses esbuild under the hood) as a bridge.
esbuild has a watch mode and a built-in dev server with live reload, but it does not support hot module replacement (HMR) at the component level. Vite adds HMR on top of esbuild transforms.
Vite uses esbuild for dependency pre-bundling and TypeScript/JSX transforms during development. For production builds, Vite uses Rollup by default but can be configured to use esbuild for the final bundle as well.
Yes. esbuild has been stable since 2020 and is used in production by Vite, Bun, Snowpack, and thousands of projects. It follows semver and maintains backward compatibility across releases.
Citations (3)
- esbuild GitHub— esbuild bundles three.js in ~0.3s vs ~35s for webpack
- esbuild FAQ— Written in Go by Evan Wallace, Figma co-founder
- Vite Documentation— Powers Vite as its transform engine
Related on TokRepo
Discussion
Related Assets
Mako — Extremely Fast Rust-Based JavaScript Bundler
Mako is a production-grade JavaScript and TypeScript bundler written in Rust by the Ant Group (Umi.js team). It delivers build speeds significantly faster than webpack while maintaining compatibility with the webpack ecosystem including loaders, plugins, and module federation.
Rolldown — Rust-Powered JavaScript Bundler and the Future of Vite
Rolldown is a Rust-based Rollup-compatible bundler built by the Vite team. It replaces esbuild + Rollup in Vite with a single fast bundler, bringing dramatic speed improvements while keeping the plugin API developers already know.
SWC — Super-Fast Rust-Based JavaScript and TypeScript Compiler
SWC is an extensible Rust-based platform for the next generation of fast developer tools. It can be used for both compilation and bundling, offering 20x faster performance than Babel while maintaining compatibility with its ecosystem.
Actix Web — Extremely Fast Web Framework for Rust
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust. Consistently tops TechEmpower benchmarks. Built on the Actix actor framework with a rich middleware system, WebSocket support, and HTTP/2.