Scroll to navigation

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 all dependencies into the output files
Substitute K with V while parsing
Exclude module M from the bundle (can use * wildcards)
Output format (iife | cjs | esm, no default when not bundling, otherwise default is iife when platform is browser and cjs when platform is node)
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 the output (sets all --minify-* flags)
The output directory (for multiple entry points)
The output file (for one entry point)
Set to “external” to avoid bundling any package
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)
Environment target (e.g. es2017, chrome58, firefox57, safari11, edge16, node10, ie9, opera45, default esnext)
Watch mode: rebuild on file system changes (stops when stdin is closed, use “--watch=forever” to ignore stdin)

ADVANCED OPTIONS

Allow output files to overwrite input files
Print a report about the contents of the bundle (use “--analyze=verbose” for a detailed report)
Path template to use for “file” loader files (default “[name]-[hash]”)
Text to be prepended to each output file of type T where T is one of: css | js
Certificate for serving HTTPS (see also “--keyfile”)
Do not escape UTF-8 code points
Path template to use for code splitting chunks (default “[name]-[hash]”)
Force use of color terminal escapes (true | false)
Remove certain constructs (console | debugger)
Remove labeled statements with these label names
Path template to use for entry point output paths (default “[dir]/[name]”, can also use “[hash]”)
Text to be appended to each output file of type T where T is one of: css | js
The name of the global for the IIFE format --ignore-annotations Enable this to work with packages that have incorrect tree-shaking annotations
Import the file F into all input files and automatically replace matching globals with imports
Use React’s automatic runtime in development mode
What to use for JSX instead of React.createElement
What to use for JSX instead of React.Fragment
Override the package name for the automatic runtime (default “react”)
Do not remove unused JSX expressions
Set to “automatic” to use React’s automatic runtime or to “preserve” to disable transforming JSX to JS
Preserve “name” on functions and classes
Key for serving HTTPS (see also “--certfile”)
Where to place legal comments (none | inline | eof | linked | external, default eof when bundling and inline otherwise)
Lines longer than this will be wrap onto a new line
Disable logging (verbose | debug | info | warning | error | silent, default info)
Maximum message count or 0 to disable (default 6)
Use log level Y for log messages with identifier X
Override the main file order in package.json (default “browser,module,main” when platform is browser and “main,module” when platform is node)
Save “mangle props” decisions to a JSON file
Rename all properties matching a regular expression
Enable renaming of quoted properties (true | false)
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
Use a custom output extension instead of “.js”
The base path used to determine entry point output paths (for multiple entry points)
Disable symlink resolution for module lookup
Set the base URL for the “file” loader
Mark the name N as a pure function for tree shaking
Do not mangle these properties
A comma-separated list of implicit extensions (default “.tsx,.ts,.jsx,.js,.css,.json”)
Serve this HTML page when the request doesn’t match
What to serve in addition to generated output files
Sets the “sourceRoot” field in generated source maps
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
Consider syntax F to be supported (true | false)
Force tree shaking on or off (false | true)
Use this tsconfig.json file instead of other ones
Print the current version (0.20.2) and exit

EXAMPLES

# Produces dist/entry_point.js and dist/entry_point.js.map
# Allow JSX syntax in .js files
# Substitute the identifier RELEASE for the literal true
# Provide input via stdin, get output via stdout
# Automatically rebuild when input files are changed
# 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

2024-03-14 esbuild 0.20.2