Esbuild
Esbuild is an extremely fast JavaScript bundler and minifier, written in Go, that parallelises parsing and avoids intermediate ASTs.
Definition
Esbuild is a bundler, transpiler, and minifier for JavaScript and TypeScript written in Go for speed. It parses, transforms, and links in a single pass, leveraging Go concurrency and a design that avoids repeated AST transformations. It exposes a CLI and a JavaScript API, supports tree shaking and code splitting, and is often embedded inside other tools as their fast core, though its transform coverage for advanced language features is narrower than the slower Babel-based pipelines.
Context and scope
Used as a fast build and dev-server core for web projects, in CI where build time matters, and as a bundling dependency inside frameworks and other tools.
Common misconceptions
- Fast means less correct — it is fast by design; its feature coverage is narrower in advanced transforms, not its correctness on what it supports
- It replaces all tooling — it handles bundling, transpiling, and minifying, but type checking and some transforms still need other tools
- Tree shaking is automatic and complete — it shakes ES modules with static analysis, but dynamic requires and side-effect declarations limit it
Anti-patterns
- Bundling without marking side-effect-free packages, so tree shaking keeps code that could be dropped
- Relying on esbuild to type check, since transpilation strips types without checking them
- Ignoring bundle analysis and shipping large dependencies its speed did not reveal
Related concepts
Related examples
Authoritative source
What it is
Esbuild bundles JavaScript and TypeScript into output files, transpiling modern syntax, resolving imports, and minifying. Its performance comes from being written in Go, using concurrency across cores and files, and avoiding the repeated AST construction and serialisation that slower pipelines incur. It offers both a fast CLI and an API embeddable in Node.js, and it supports tree shaking of ES modules, code splitting, and a dev server with hot reload.
Why it matters
Build time shapes developer feedback and CI cost. Pipelines that took tens of seconds can drop to a fraction, which makes fast iteration and frequent integration realistic. The same engine being usable across tools also reduces the number of slow stages in a build, and its small footprint makes it a natural bundling core inside frameworks that previously assembled their own pipeline.
How to use it well
Pair it with a separate type checker, because transpilation erases types without verifying them. Mark packages side-effect-free so tree shaking can drop unreachable code, and audit bundles regularly — speed does not prevent a large dependency from shipping. Keep the esbuild version pinned for reproducible output, and when your project needs an advanced transform esbuild does not yet cover, isolate that step rather than replacing the whole fast pipeline.