ConfigsApr 11, 2026·2 min read

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.

TL;DR
esbuild bundles JavaScript and TypeScript 10-100x faster than webpack by leveraging Go parallelism.
§01

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.

§02

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.

§03

How to use

  1. Install esbuild with npm i -D esbuild.
  2. Run the CLI to bundle your entry point: npx esbuild src/app.ts --bundle --outfile=dist/app.js.
  3. Add flags for your target environment: --platform=browser --target=es2020 --minify --sourcemap.
§04

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,
});
§05

Related on TokRepo

§06

Common pitfalls

  • esbuild strips TypeScript types but does not run type checking. Pair it with tsc --noEmit in 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 dynamic import() splitting.

Frequently Asked Questions

Why is esbuild so much faster than webpack?+

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.

Can esbuild replace webpack entirely?+

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.

Does esbuild support hot module replacement?+

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.

What is esbuild's relationship with Vite?+

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.

Is esbuild production-ready?+

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)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets