ESBUILD(1) esbuild Manual ESBUILD(1)
NAME
esbuild - an extremely fast JavaScript bundler and minifier
SYNOPSIS
esbuild [options] [entry points]
DESCRIPTION
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.
SIMPLE OPTIONS
--bundle
Bundle all dependencies into the output files
--define:K=V
Substitute K with V while parsing
--external:M
Exclude module M from the bundle (can use * wildcards)
--format=...
Output format (iife | cjs | esm, no default when not bundling,
otherwise default is iife when platform is browser and cjs when
platform is node)
--loader:X=L
Use loader L to load file extension X, where L is one of: base64
| binary | copy | css | dataurl | empty | file | global-css | js
| json | jsx | local-css | text | ts | tsx
--minify
Minify the output (sets all --minify-* flags)
--outdir=...
The output directory (for multiple entry points)
--outfile=...
The output file (for one entry point)
--packages=...
Set to “external” to avoid bundling any package
--platform=...
Platform target (browser | node | neutral, default browser)
--serve=...
Start a local HTTP server on this host:port for outputs
--sourcemap
Emit a source map
--splitting
Enable code splitting (currently only for esm)
--target=...
Environment target (e.g. es2017, chrome58, firefox57, safari11,
edge16, node10, ie9, opera45, default esnext)
--watch
Watch mode: rebuild on file system changes (stops when stdin is
closed, use “--watch=forever” to ignore stdin)
ADVANCED OPTIONS
--allow-overwrite
Allow output files to overwrite input files
--analyze
Print a report about the contents of the bundle (use
“--analyze=verbose” for a detailed report)
--asset-names=...
Path template to use for “file” loader files (default
“[name]-[hash]”)
--banner:T=...
Text to be prepended to each output file of type T where T is one
of: css | js
--certfile=...
Certificate for serving HTTPS (see also “--keyfile”)
--charset=utf8
Do not escape UTF-8 code points
--chunk-names=...
Path template to use for code splitting chunks (default
“[name]-[hash]”)
--color=...
Force use of color terminal escapes (true | false)
--drop:...
Remove certain constructs (console | debugger)
--drop-labels=...
Remove labeled statements with these label names
--entry-names=...
Path template to use for entry point output paths (default
“[dir]/[name]”, can also use “[hash]”)
--footer:T=...
Text to be appended to each output file of type T where T is one
of: css | js
--global-name=...
The name of the global for the IIFE format --ignore-annotations
Enable this to work with packages that have incorrect tree-
shaking annotations
--inject:F
Import the file F into all input files and automatically replace
matching globals with imports
--jsx-dev
Use React’s automatic runtime in development mode
--jsx-factory=...
What to use for JSX instead of React.createElement
--jsx-fragment=...
What to use for JSX instead of React.Fragment
--jsx-import-source=...
Override the package name for the automatic runtime (default
“react”)
--jsx-side-effects
Do not remove unused JSX expressions
--jsx=...
Set to “automatic” to use React’s automatic runtime or to
“preserve” to disable transforming JSX to JS
--keep-names
Preserve “name” on functions and classes
--keyfile=...
Key for serving HTTPS (see also “--certfile”)
--legal-comments=...
Where to place legal comments (none | inline | eof | linked |
external, default eof when bundling and inline otherwise)
--line-limit=...
Lines longer than this will be wrap onto a new line
--log-level=...
Disable logging (verbose | debug | info | warning | error |
silent, default info)
--log-limit=...
Maximum message count or 0 to disable (default 6)
--log-override:X=Y
Use log level Y for log messages with identifier X
--main-fields=...
Override the main file order in package.json (default
“browser,module,main” when platform is browser and “main,module”
when platform is node)
--mangle-cache=...
Save “mangle props” decisions to a JSON file
--mangle-props=...
Rename all properties matching a regular expression
--mangle-quoted=...
Enable renaming of quoted properties (true | false)
--metafile=...
Write metadata about the build to a JSON file (see also:
https://esbuild.github.io/analyze/)
--minify-whitespace
Remove whitespace in output files
--minify-identifiers
Shorten identifiers in output files
--minify-syntax
Use equivalent but shorter syntax in output files
--out-extension:.js=.mjs
Use a custom output extension instead of “.js”
--outbase=...
The base path used to determine entry point output paths (for
multiple entry points)
--preserve-symlinks
Disable symlink resolution for module lookup
--public-path=...
Set the base URL for the “file” loader
--pure:N
Mark the name N as a pure function for tree shaking
--reserve-props=...
Do not mangle these properties
--resolve-extensions=...
A comma-separated list of implicit extensions (default
“.tsx,.ts,.jsx,.js,.css,.json”)
--serve-fallback...
Serve this HTML page when the request doesn’t match
--servedir=...
What to serve in addition to generated output files
--source-root=...
Sets the “sourceRoot” field in generated source maps
--sourcefile=...
Set the source file for the source map (for stdin)
--sourcemap=external
Do not link to the source map with a comment
--sourcemap=inline
Emit the source map with an inline data URL
--sources-content=false
Omit “sourcesContent” in generated source maps
--supported:F=...
Consider syntax F to be supported (true | false)
--tree-shaking=...
Force tree shaking on or off (false | true)
--tsconfig=...
Use this tsconfig.json file instead of other ones
--tsconfig-raw=...
Override all tsconfig.json files with this string
--version
Print the current version (0.25.0) and exit
EXAMPLES
esbuild --bundle entry_point.js --outdir=dist --minify --sourcemap
# Produces dist/entry_point.js and dist/entry_point.js.map
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
esbuild app.ts --bundle --watch
# Automatically rebuild when input files are changed
esbuild app.ts --bundle --servedir=www --outdir=www/js
# Start a local HTTP server for everything in “www”
AUTHOR
esbuild is written by Evan Wallace.
This manual page is prepared for Debian by Anthony Fok using information
from upstream README.md and output of esbuild --help.
COPYRIGHT
Copyright © 2020 Evan Wallace
License: MIT (Expat)
SEE ALSO
Documentation: https://esbuild.github.io/
Repository: https://github.com/evanw/esbuild
esbuild 0.25.0 2025-02-13 ESBUILD(1)
Generated by dwww version 1.16 on Tue Dec 9 01:22:14 CET 2025.