Guide · Open source
How to use esbuild: install, bundle and minify code
Updated · written with AI from the project's own documentation and checked against our catalogue data
esbuild is an open-source bundler that takes web source code written in JavaScript, TypeScript, JSX and CSS and combines it into files browsers can load. This guide explains what it does, how to get started, and which features the project documents. By the end you will know whether esbuild fits your project and where to find the detailed reference.
Quick start
- 1Read the getting started guide. Open the official getting started page linked from the esbuild README to find the install instructions.
- 2Install esbuild with a package manager. Follow the install method in the getting started guide. The README lists no separate prerequisites.
- 3Pick CLI, JavaScript or Go. Choose the API that matches your project so your build script calls esbuild the way your team expects.
- 4Bundle your entry file. Point esbuild at your JavaScript, TypeScript, JSX or CSS entry point and produce a bundle the browser can load.
- 5Enable minification and source maps. Turn on minify or sourcemap options from the API docs when you need smaller output or easier debugging.
- 6Try watch mode or the local server. Use watch mode to rebuild on file changes, or the local server while developing, as described in the API docs.
What does esbuild do?
Bundling means combining your source files into output files that a browser can load. esbuild also minifies code to make it smaller and can produce source maps to help with debugging.
The project's main selling point is speed. It states that current web build tools are often 10-100x slower than they could be, and that esbuild achieves extreme speed without needing a cache.
- JavaScript, CSS, TypeScript and JSX are built in
- Bundles ESM and CommonJS modules
- Bundles CSS, including CSS modules
- Tree shaking, minification and source maps
- Local server, watch mode and plugins
Install esbuild
esbuild is installed through a package manager. The README does not list any prerequisites. For the exact install command and setup steps, follow the getting started guide on the official website, which the README links to.
The README's install command is for cloning the repository: git clone https://github.com/evanw/esbuild. Use that if you want the source code itself.
git clone https://github.com/evanw/esbuildChoose how to call esbuild: CLI, JavaScript or Go
esbuild offers a straightforward API for three environments: the command line interface (CLI), JavaScript, and Go. Pick the one that matches how your project already builds.
The full API reference, including build options, is in the documentation site linked from the README.
- CLI for simple scripts and command-line builds
- JavaScript API for Node-based build scripts
- Go API if your tooling is written in Go
Use the main build features
Minification, source maps, the local server and watch mode are all documented as separate API sections on the esbuild site. Enable only the ones your project needs.
Plugins extend esbuild, but their details live on the external plugins documentation, not in the README.
- Minify output: see the minify section of the API docs
- Generate source maps: see the sourcemap section of the API docs
- Serve files locally: see the serve section of the API docs
- Rebuild on change: see the watch section of the API docs
What people use it for
- Bundling a JavaScript or TypeScript frontend into files a browser can load
- Building a React or other JSX-based frontend
- Bundling a project that mixes ESM and CommonJS modules
- Bundling CSS, including CSS modules, alongside JavaScript
- Adding a fast build step to a CLI or Go-based toolchain
Frequently asked questions
Is esbuild free to use?
esbuild is released under the MIT licence, as stated in the project's listing. Check the LICENSE file in the repository for the full terms.
What does esbuild need to run?
The source does not list any prerequisites. The official getting started guide covers installation steps.
How do I install esbuild?
The README says esbuild is installed through a package manager. Follow the install instructions on the official getting started page, since the README only shows a git clone command for the source.
Does esbuild support TypeScript and JSX?
Yes. The README lists JavaScript, CSS, TypeScript and JSX as built in, so you do not need a separate tool for those file types.
What are the alternatives to esbuild?
Comparable projects named in the analysis are Vite, webpack, Rollup and Parcel. esbuild's distinguishing claim is its speed without a cache, so compare on build time and on the plugins your project depends on.
Can esbuild be used with plugins?
esbuild supports plugins, but the README does not describe them in detail. Plugin documentation is on the external esbuild site, so check there before relying on a specific plugin feature.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
esbuild suits developers who want very fast builds for JavaScript, TypeScript, JSX or CSS projects, and teams that want a simple CLI, JavaScript or Go API. It is less suited to beginners who want a guided, hand-held setup, or to projects that depend on plugin behaviour the README does not describe, where a tool like Vite, webpack, Rollup or Parcel may be easier.
Install options & downloads