.\" Hey, EMACS: -*- nroff -*- .\" (C) Copyright 2020-2023 Anthony Fok .\" .\" 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" "2023-01-13" "esbuild 0.17.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 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\fP and .\" \fI\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 | js | json | jsx | 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 .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 \-\-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 \-\-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 \-\-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 .B \-\-version Print the current version (0.17.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[]