esbuild

esbuild is an extremely fast JavaScript and TypeScript bundler and minifier, written in Go and heavily parallelized. It's often 10–100× faster than older JavaScript-based tools, which is why it shows up inside other tools — Vite uses it to pre-bundle dependencies and transform TypeScript.

Speed is its whole identity. esbuild trades some of the deep plugin ecosystems of webpack/Rollup for raw throughput, making it ideal for dev tooling, libraries, and CI builds where build time dominates.

TL;DR

Quick Example

Bundle and minify with the build API — a whole pipeline in a few lines:

Where esbuild Fits

Best Practices

Comparison: where each tool sits

Common Mistakes

Assuming esbuild type-checks

ESM/CJS format mismatches

FAQ

Does esbuild type-check my TypeScript?

No. esbuild transpiles by stripping types for speed, but it doesn't validate them. Run the TypeScript compiler (tsc --noEmit) or your editor/CI separately to catch type errors.

When should I use esbuild directly vs through Vite?

Use Vite for full apps — it wraps esbuild (dev) and Rollup (prod) with framework support and a plugin ecosystem. Use esbuild directly for libraries, scripts, or custom build steps where you want raw speed and minimal configuration.

Why is esbuild so much faster?

It's written in Go (compiled, parallel) instead of JavaScript, and it makes deliberate design choices that favor speed. The result is order-of-magnitude faster builds than traditional JS-based bundlers.

Can esbuild replace webpack entirely?

For many libraries and simpler apps, yes. For large apps needing webpack's extensive plugin/loader ecosystem or specific optimizations, it's usually used as a building block (e.g. inside Vite) rather than a full replacement.

Related Topics

References