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.
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
HumHub — Open-Source Enterprise Social Network
A flexible, open-source social networking platform built on Yii2 for creating private communities, intranets, and collaboration spaces within organizations.
Dolibarr — Open-Source ERP & CRM for Business Management
A modular open-source ERP and CRM application written in PHP for managing contacts, invoices, orders, inventory, accounting, and more from a single web interface.
PrestaShop — Open-Source PHP E-Commerce Platform
A widely adopted open-source e-commerce platform written in PHP with a rich module marketplace, multi-language support, and a strong European user base.