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

--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)

--global-name=...
    The name of the global for the IIFE format

--jsx-factory=...
    What to use instead of React.createElement

--jsx-fragment=...
    What to use instead of React.Fragment

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

--minify
    Sets all --minify-* flags

--minify-whitespace
    Remove whitespace

--minify-identifiers
    Shorten identifiers

--minify-syntax
    Use equivalent but shorter syntax

--outdir=...
    The output directory (for multiple entry points)

--outfile=...
    The output file (for one entry point)

--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)

--summary
    Print some helpful information at the end of a build

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

--watch
    Watch mode: rebuild on file system changes

ADVANCED OPTIONS

--banner=...
    Text to be prepended to each output file

--charset=utf8
    Do not escape UTF-8 code points

--color=...
    Force use of color terminal escapes (true | false)

--error-limit=...
    Maximum error count or 0 to disable (default 10)

--footer=...
    Text to be appended to each output file

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

--keep-names
    Preserve “name” on functions and classes

--log-level=...
    Disable logging (info | warning | error | silent, default info)

--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)

--metafile=...
    Write metadata about the build to a JSON file

--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)

--public-path=...
    Set the base URL for the “file” loader

--pure:N
    Mark the name N as a pure function for tree shaking

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

--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

--tree-shaking=...
    Set to “ignore-annotations” to work with packages

--tsconfig=...
    Use this tsconfig.json file instead of other ones

--version
    Print the current version (0.8.39) 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

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