OptionsOn esbuild itself
--bundle
Bundle all dependencies into the output files
--define
Replace variable names with a literal value, eg. --define:DEBUG=true <name=value>
--external
Exclude modules from the build <module specifier>
--format
The output format <format>
--loader
For a given file extension, specify a loader <loaders>
--minify
Minify the output (sets all the --minify-* options)
--outdir
The output directory for multiple entrypoints <path>
--outfile
The output file for one entrypoint <path>
--platform
The platform target <name>
--serve
Start a local HTTP server on this host:port <[address:]port>
--splitting
Enable code splitting
--target
Set the environment target. Can be a particular ES version or browser version, eg. chrome101 <target>
--watch
Rebuild on file system changes <forever>
--allow-overwrite
Allow output files to overwrite input files
--analyze
Print a report about the contents of the bundle <verbose>
--asset-names
Path template for 'file' loader files <template>
--banner
Text to be prepended to each output file type <ext=text[,ext=text...]>
--charset
Use UTF-8 instead of escaped codepoints in ASCII <value>
--chunk-names
Path template to use for code splitting chunks <template>
--color
Force use of terminal colors <enabled>
--drop
Remove certain constructs <value>
--entry-names
Path template to use for entry point output paths <template>
--footer
Text to be appended to each file type <ext=text>
--global-name
The name of the global if using --format=iife <name>
--ignore-annotations
Enable this to work with packages that have incorrect tree-shaking annotations
--inject
Import the file into all input files, automatically replace matching globals <import>
--jsx-factory
What to use for the JSX factory <factory>
--jsx-fragment
What to use for the JS Fragment factory <fragment>
--jsx
Preserve JSX instead of transforming <value>
--jsx-dev
Toggles development mode for the automatic runtime
--jsx-import-source
Overrides the root import for runtime functions (default: react) <source>
--keep-names
Preserve 'name' on functions and classes
--legal-comments
Where to place legal comments <location>
--log-level
Set the log level <level>
--log-limit
Maximum message count, 0 to disable <count>
--log-override
For a particular identifier, set the log level <identifier:level>
--main-fields
Override the main file order in package.json <field order>
--mangle-cache
Save 'mangle props' decisions to a JSON file <path>
--mangle-props
Rename all properties matching a regular expression <regex>
--mangle-quoted
Enable mangling (renaming) quoted properties <status>
--metafile
Write metadata about the build to a JSON file <path>
--minify-whitespace
Remove unnecessary whitespace in output files
--minify-identifiers
Shorten identifiers in output files
--minify-syntax
Use equivalent but shorter syntax in output files
--out-extension
Use a custom output extension for each extension <ext=new>
--outbase
Base path used to determine entrypoint output paths, for multiple entrypoints <path>
--preserve-symlinks
Disable symlink resolution
--public-path
Set the base URL for the 'file' loader <path>
--pure
Mark the name as a pure function for tree shaking <name>
--reserve-props
Do not mangle these properties <properties>
--resolve-extensions
Comma-separated list of implicit extensions <extensions>
--servedir
What to serve in addition to the generated output files <path>
--source-root
Set the sourceRoot field in generated source maps <URL>
--sourcefile
Set the source file for the source map if there's no file name to use <name>
--sourcemap
Generate source maps? <options>
--sources-content
Omit the sourcesContent field in generated source maps <value>
--supported
Consider a given syntax to be supported <syntax=status>
--tree-shaking
Force tree shaking on or off <status>
--tsconfig
Use this TypeScript config instead of the default <path>
--version
Print the current version and exit