JavaScript bundler and minifier built for speed.


Bundle a JavaScript application and print to stdout

$ esbuild --bundle [path/to/file.js]

Bundle a JSX application from stdin
$ esbuild --bundle --outfile=[path/to/out.js] < [path/to/file.jsx]

Bundle and minify a JSX application with source maps in production mode
$ esbuild --bundle --define:[process.env.NODE_ENV=\"production\"] --minify --sourcemap [path/to/file.js]

Bundle a JSX application for a comma-separated list of browsers
$ esbuild --bundle --minify --sourcemap --target=[chrome58,firefox57,safari11,edge16] [path/to/file.jsx]

Bundle a JavaScript application for a specific node version
$ esbuild --bundle --platform=[node] --target=[node12] [path/to/file.js]

Bundle a JavaScript application enabling JSX syntax in .js files
$ esbuild --bundle app.js --loader:[.js=jsx] [path/to/file.js]

Bundle and serve a JavaScript application on an HTTP server
$ esbuild --bundle --serve=[port] --outfile=[index.js] [path/to/file.js]

Bundle a list of files to an output directory
$ esbuild --bundle --outdir=[path/to/output_directory] [path/to/file1 path/to/file2 ...]


esbuild [options] [entry points]


esbuild is a JavaScript bundler and minifier. It packages up JavaScript and TypeScript code for distribution on the web.

Why build another JavaScript build tool? The current build tools for the web are at least an order of magnitude slower than they should be. It is hoped that this project serves as an “existence proof” that JavaScript tooling can be much, much faster.



Bundle all dependencies into the output files


Substitute K with V while parsing


Exclude module M from the bundle


Output format (iife | cjs | esm, no default when not bundling, otherwise default is iife when platform is browser and cjs when platform is node)


The name of the global for the IIFE format


What to use instead of React.createElement


What to use instead of React.Fragment


Use loader L to load file extension X, where L is one of: js | jsx | ts | tsx | json | text | base64 | file | dataurl | binary


Sets all --minify-* flags


Remove whitespace


Shorten identifiers


Use equivalent but shorter syntax


The output directory (for multiple entry points)


The output file (for one entry point)


Platform target (browser | node | neutral, default browser)


Start a local HTTP server on this host:port for outputs


Emit a source map


Enable code splitting (currently only for esm)


Print some helpful information at the end of a build


Environment target (e.g. es2017, chrome58, firefox57, safari11, edge16, node10, default esnext)


Watch mode: rebuild on file system changes



Text to be prepended to each output file


Do not escape UTF-8 code points


Force use of color terminal escapes (true | false)


Maximum error count or 0 to disable (default 10)


Text to be appended to each output file


Import the file F into all input files and automatically replace matching globals with imports


Preserve “name” on functions and classes


Disable logging (info | warning | error | silent, default info)


Override the main file order in package.json (default “browser,module,main” when platform is browser and “main,module” when platform is node)


Write metadata about the build to a JSON file


Use a custom output extension instead of “.js”


The base path used to determine entry point output paths (for multiple entry points)


Set the base URL for the “file” loader


Mark the name N as a pure function for tree shaking


A comma-separated list of implicit extensions (default “.tsx,.ts,.jsx,.mjs,.cjs,.js,.css,.json”)


Set the source file for the source map (for stdin)


Do not link to the source map with a comment


Emit the source map with an inline data URL


Omit “sourcesContent” in generated source maps


Set to “ignore-annotations” to work with packages


Use this tsconfig.json file instead of other ones


Print the current version (0.8.39) and exit


esbuild --bundle entry_point.js --outdir=dist --minify --sourcemap

# Produces dist/entry_point.js and dist/

esbuild --bundle entry_point.js --outfile=out.js --loader:.js=jsx

# Allow JSX syntax in .js files

esbuild example.js --outfile=out.js --define:RELEASE=true

# Substitute the identifier RELEASE for the literal true

esbuild --minify --loader=ts < input.ts > output.js

# Provide input via stdin, get output via stdout


Copyright © 2020 Evan Wallace
License: MIT (Expat)


Documentation: Repository:


esbuild is written by Evan Wallace.

This manual page is prepared for Debian by Anthony Fok using information from upstream and output of esbuild --help.

Copied to clipboard