1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
.\" Hey, EMACS: -*- nroff -*-
.\" (C) Copyright 2020-2024 Anthony Fok <foka@debian.org>
.\"
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH ESBUILD "1" "2025-02-13" "esbuild 0.25.0" "esbuild Manual"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.nh
.ad l
.SH NAME
esbuild \- an extremely fast JavaScript bundler and minifier
.SH SYNOPSIS
.B esbuild
.RI [ options ]
.RI [ "entry points" ]
.SH DESCRIPTION
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBesbuild\fP is a JavaScript bundler and minifier.
It packages up JavaScript and TypeScript code for distribution on the web.
.PP
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 \(lqexistence proof\(rq that JavaScript tooling
can be much, much faster.
.SH SIMPLE OPTIONS
.TP
.B \-\-bundle
Bundle all dependencies into the output files
.TP
.BI \-\-define: K = V
Substitute \fIK\fP with \fIV\fP while parsing
.TP
.BI \-\-external: M
Exclude module \fIM\fP from the bundle (can use * wildcards)
.TP
.BI \-\-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)
.TP
.BI \-\-loader: X = L
Use loader \fIL\fP to load file extension \fIX\fP, where \fIL\fP is one of:
base64 | binary | copy | css | dataurl | empty | file | global-css | js | json | jsx | local-css | text | ts | tsx
.TP
.B \-\-minify
Minify the output (sets all \-\-minify\-* flags)
.TP
.BI \-\-outdir= ...
The output directory (for multiple entry points)
.TP
.BI \-\-outfile= ...
The output file (for one entry point)
.TP
.BI \-\-packages= ...
Set to \(lqexternal\(rq to avoid bundling any package
.TP
.BI \-\-platform= ...
Platform target (browser | node | neutral, default browser)
.TP
.BI \-\-serve= ...
Start a local HTTP server on this host:port for outputs
.TP
.B \-\-sourcemap
Emit a source map
.TP
.B \-\-splitting
Enable code splitting (currently only for esm)
.TP
.BI \-\-target= ...
Environment target (e.g. es2017, chrome58, firefox57, safari11, edge16, node10, ie9, opera45, default esnext)
.TP
.B \-\-watch
Watch mode: rebuild on file system changes (stops when
stdin is closed, use \(lq\-\-watch=forever\(rq to ignore stdin)
.SH ADVANCED OPTIONS
.TP
.B \-\-allow\-overwrite
Allow output files to overwrite input files
.TP
.B \-\-analyze
Print a report about the contents of the bundle
(use \(lq\-\-analyze=verbose\(rq for a detailed report)
.TP
.BI \-\-asset\-names= ...
Path template to use for \(lqfile\(rq loader files
(default \(lq[name]-[hash]\(rq)
.TP
.BI \-\-banner: T = ...
Text to be prepended to each output file of type T
where T is one of: css | js
.TP
.BI \-\-certfile= ...
Certificate for serving HTTPS (see also \(lq\-\-keyfile\(rq)
.TP
.B \-\-charset=utf8
Do not escape UTF-8 code points
.TP
.BI \-\-chunk\-names= ...
Path template to use for code splitting chunks
(default \(lq[name]-[hash]\(rq)
.TP
.BI \-\-color= ...
Force use of color terminal escapes (true | false)
.TP
.BI \-\-drop: ...
Remove certain constructs (console | debugger)
.TP
.BI \-\-drop\-labels= ...
Remove labeled statements with these label names
.TP
.BI \-\-entry\-names= ...
Path template to use for entry point output paths
(default \(lq[dir]/[name]\(rq, can also use \(lq[hash]\(rq)
.TP
.BI \-\-footer: T = ...
Text to be appended to each output file of type T
where T is one of: css | js
.TP
.BI \-\-global\-name= ...
The name of the global for the IIFE format
.B \-\-ignore\-annotations
Enable this to work with packages that have
incorrect tree-shaking annotations
.TP
.BI \-\-inject: F
Import the file \fIF\fP into all input files and
automatically replace matching globals with imports
.TP
.B \-\-jsx\-dev
Use React\(cqs automatic runtime in development mode
.TP
.BI \-\-jsx\-factory= ...
What to use for JSX instead of React.createElement
.TP
.BI \-\-jsx\-fragment= ...
What to use for JSX instead of React.Fragment
.TP
.BI \-\-jsx\-import\-source= ...
Override the package name for the automatic runtime
(default \(lqreact\(rq)
.TP
.B \-\-jsx-side-effects
Do not remove unused JSX expressions
.TP
.BI \-\-jsx= ...
Set to \(lqautomatic\(rq to use React\(cqs automatic runtime
or to \(lqpreserve\(rq to disable transforming JSX to JS
.TP
.B \-\-keep\-names
Preserve \(lqname\(rq on functions and classes
.TP
.BI \-\-keyfile= ...
Key for serving HTTPS (see also \(lq\-\-certfile\(rq)
.TP
.BI \-\-legal\-comments= ...
Where to place legal comments (none | inline |
eof | linked | external, default eof when bundling
and inline otherwise)
.TP
.BI \-\-line\-limit= ...
Lines longer than this will be wrap onto a new line
.TP
.BI \-\-log\-level= ...
Disable logging (verbose | debug | info | warning |
error | silent, default info)
.TP
.BI \-\-log\-limit= ...
Maximum message count or 0 to disable (default 6)
.TP
.BI \-\-log-override: X = Y
Use log level \fIY\fP for log messages with identifier \fIX\fP
.TP
.BI \-\-main\-fields= ...
Override the main file order in package.json
(default \(lqbrowser,module,main\(rq when platform is
browser and \(lqmain,module\(rq when platform is node)
.TP
.BI \-\-mangle\-cache= ...
Save \(lqmangle props\(rq decisions to a JSON file
.TP
.BI \-\-mangle\-props= ...
Rename all properties matching a regular expression
.TP
.BI \-\-mangle\-quoted= ...
Enable renaming of quoted properties (true | false)
.TP
.BI \-\-metafile= ...
Write metadata about the build to a JSON file
(see also: https://esbuild.github.io/analyze/)
.TP
.B \-\-minify\-whitespace
Remove whitespace in output files
.TP
.B \-\-minify\-identifiers
Shorten identifiers in output files
.TP
.B \-\-minify\-syntax
Use equivalent but shorter syntax in output files
.TP
.BI \-\-out\-extension: .js = .mjs
Use a custom output extension instead of \(lq.js\(rq
.TP
.BI \-\-outbase= ...
The base path used to determine entry point output
paths (for multiple entry points)
.TP
.B \-\-preserve\-symlinks
Disable symlink resolution for module lookup
.TP
.BI \-\-public\-path= ...
Set the base URL for the \(lqfile\(rq loader
.TP
.BI \-\-pure: N
Mark the name \fIN\fP as a pure function for tree shaking
.TP
.BI \-\-reserve\-props= ...
Do not mangle these properties
.TP
.BI \-\-resolve\-extensions= ...
A comma-separated list of implicit extensions
(default \(lq.tsx,.ts,.jsx,.js,.css,.json\(rq)
.TP
.BI \-\-serve\-fallback ...
Serve this HTML page when the request doesn\(cqt match
.TP
.BI \-\-servedir= ...
What to serve in addition to generated output files
.TP
.BI \-\-source\-root= ...
Sets the \(lqsourceRoot\(rq field in generated source maps
.TP
.BI \-\-sourcefile= ...
Set the source file for the source map (for stdin)
.TP
.B \-\-sourcemap=external
Do not link to the source map with a comment
.TP
.B \-\-sourcemap=inline
Emit the source map with an inline data URL
.TP
.B \-\-sources\-content=false
Omit \(lqsourcesContent\(rq in generated source maps
.TP
.BI \-\-supported: F = ...
Consider syntax \fIF\fP to be supported (true | false)
.TP
.BI \-\-tree\-shaking= ...
Force tree shaking on or off (false | true)
.TP
.BI \-\-tsconfig= ...
Use this tsconfig.json file instead of other ones
.TP
.BI \-\-tsconfig\-raw= ...
Override all tsconfig.json files with this string
.TP
.B \-\-version
Print the current version (0.25.0) and exit
.SH EXAMPLES
.TP 4
.B esbuild \-\-bundle entry_point.js \-\-outdir=dist \-\-minify \-\-sourcemap
# Produces dist/entry_point.js and dist/entry_point.js.map
.TP
.B esbuild \-\-bundle entry_point.js \-\-outfile=out.js \-\-loader:.js=jsx
# Allow JSX syntax in .js files
.TP
.B esbuild example.js \-\-outfile=out.js \-\-define:RELEASE=true
# Substitute the identifier RELEASE for the literal true
.TP
.B esbuild \-\-minify \-\-loader=ts < input.ts > output.js
# Provide input via stdin, get output via stdout
.TP
.B esbuild app.ts \-\-bundle \-\-watch
# Automatically rebuild when input files are changed
.TP
.B
esbuild app.ts \-\-bundle \-\-servedir=www \-\-outdir=www/js
# Start a local HTTP server for everything in \(lqwww\(rq
.SH AUTHOR
esbuild is written by Evan Wallace.
.PP
This manual page is prepared for Debian by Anthony Fok using information
from upstream README.md and output of \fBesbuild \-\-help\fP.
.SH COPYRIGHT
Copyright \(co 2020 Evan Wallace
.br
License: MIT (Expat)
.SH SEE ALSO
Documentation: \m[blue]\fBhttps://esbuild.github.io/\fR\m[]
.PP
Repository: \m[blue]\fBhttps://github.com/evanw/esbuild\fR\m[]
|