ESBUILD-WASM(1)

πŸ“¦ version 0.28.2, in ubuntu stonking

πŸ’– NAME πŸ’–

ok so welcome to esbuild-wasm(1) β€” this is the manual for esbuild, the extremely fast JavaScript bundler and minifier. no cap, that's literally what it does. πŸ¦‹


✨ SYNOPSIS ✨

esbuild [options] [entry points]

that's it bestie, options then your entry points, go off πŸ‘‘


🌸 DESCRIPTION 🌸

esbuild is a JavaScript bundler and minifier. She packages up your JavaScript and TypeScript code so it's ready to be distributed on the web. πŸŽ€

so like... why would anyone build another JavaScript build tool? because the build tools we have rn are at least an order of magnitude slower than they should be. that's not a vibe, that's a tragedy. the hope here is that this project serves as an β€œexistence proof” β€” proof that JavaScript tooling can be much, much faster. it's giving main character energy for the entire ecosystem πŸ’…


🌈 SIMPLE OPTIONS 🌈

  • --bundle β€” bundle all your dependencies straight into the output files 🫢
  • --define:K=V β€” swap K out for V while parsing, sneakily
  • --external:M β€” keep module M OUT of the bundle (you can use * wildcards here, slay)
  • --format=... β€” what the output format is (iife | cjs | esm). when you're not bundling there's no default; otherwise the default is iife when the platform is browser and cjs when the platform is node
  • --loader:X=L β€” 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 β€” minify the output (this sets all the --minify-* flags, she's an overachiever πŸ’–)
  • --outdir=... β€” the output directory (this one's for when you have multiple entry points)
  • --outfile=... β€” the output file (and this one's for when you have just one entry point)
  • --packages=... β€” set it to external to avoid bundling any package at all
  • --platform=... β€” platform target (browser | node | neutral, default browser)
  • --serve=... β€” start a local HTTP server on this host:port for your outputs 🌐
  • --sourcemap β€” emit a source map
  • --splitting β€” enable code splitting (currently only for esm, okurrr)
  • --target=... β€” environment target (e.g. es2017, chrome58, firefox57, safari11, edge16, node10, ie9, opera45, default esnext)
  • --watch β€” watch mode: rebuild whenever the file system changes. it stops when stdin is closed, so if you want it to ignore stdin use --watch=forever πŸ‘€

πŸ‘‘ ADVANCED OPTIONS πŸ‘‘

  • --allow-overwrite β€” let output files overwrite input files (chaotic, but okay)
  • --analyze β€” print a report about what's actually inside the bundle (use --analyze=verbose for the detailed version)
  • --asset-names=... β€” path template for file loader files (default [name]-[hash])
  • --banner:T=... β€” text to be prepended to each output file of type T, where T is one of: css | js
  • --certfile=... β€” certificate for serving HTTPS (see also --keyfile)
  • --charset=utf8 β€” do not escape UTF-8 code points ✨
  • --chunk-names=... β€” path template for code splitting chunks (default [name]-[hash])
  • --color=... β€” force color terminal escapes on or off (true | false)
  • --drop:... β€” remove certain constructs (console | debugger)
  • --drop-labels=... β€” remove labeled statements with these label names
  • --entry-names=... β€” path template for entry point output paths (default [dir]/[name], you can also use [hash])
  • --footer:T=... β€” text to be appended to each output file of type T, where T is one of: css | js
  • --global-name=... β€” the name of the global for the IIFE format
  • --ignore-annotations β€” enable this to work with packages that have incorrect tree-shaking annotations πŸ™ˆ
  • --inject:F β€” import the file F into all input files and automatically replace matching globals with imports
  • --jsx-dev β€” use React's automatic runtime in development mode
  • --jsx-factory=... β€” what to use for JSX instead of React.createElement
  • --jsx-fragment=... β€” what to use for JSX instead of React.Fragment
  • --jsx-import-source=... β€” override the package name for the automatic runtime (default react)
  • --jsx-side-effects β€” do not remove unused JSX expressions
  • --jsx=... β€” set to automatic to use React's automatic runtime, or to preserve to disable transforming JSX to JS
  • --keep-names β€” preserve "name" on functions and classes
  • --keyfile=... β€” key for serving HTTPS (see also --certfile)
  • --legal-comments=... β€” where to place legal comments (none | inline | eof | linked | external, default eof when bundling and inline otherwise)
  • --line-limit=... β€” lines longer than this will be wrapped onto a new line
  • --log-level=... β€” disable logging (verbose | debug | info | warning | error | silent, default info)
  • --log-limit=... β€” maximum message count, or 0 to disable it (default 6)
  • --log-override:X=Y β€” use log level Y for log messages with identifier X
  • --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)
  • --mangle-cache=... β€” save the β€œmangle props” decisions to a JSON file
  • --mangle-props=... β€” rename all properties matching a regular expression
  • --mangle-quoted=... β€” enable renaming of quoted properties (true | false)
  • --metafile=... β€” 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
  • --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)
  • --preserve-symlinks β€” disable symlink resolution for module lookup
  • --public-path=... β€” set the base URL for the file loader
  • --pure:N β€” mark the name N as a pure function for tree shaking 🌳
  • --reserve-props=... β€” do not mangle these properties (hands off 🫳)
  • --resolve-extensions=... β€” a comma-separated list of implicit extensions (default .tsx,.ts,.jsx,.js,.css,.json)
  • --serve-fallback... β€” serve this HTML page when the request doesn't match
  • --servedir=... β€” what to serve in addition to the generated output files
  • --source-root=... β€” sets the "sourceRoot" field in generated source maps
  • --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
  • --supported:F=... β€” consider syntax F to be supported (true | false)
  • --tree-shaking=... β€” force tree shaking on or off (false | true)
  • --tsconfig=... β€” use this tsconfig.json file instead of the other ones
  • --tsconfig-raw=... β€” override all tsconfig.json files with this string
  • --version β€” print the current version (0.25.0) 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

esbuild app.ts --bundle --watch
    # Automatically rebuild when input files are changed

esbuild app.ts --bundle --servedir=www --outdir=www/js
    # 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 the upstream README.md and the output of esbuild --help. 🫢


Copyright Β© 2020 Evan Wallace

License: MIT (Expat)


πŸ¦‹ SEE ALSO πŸ¦‹


okay bestie that's the whole page, you're officially esbuild-pilled πŸ’– go bundle something iconic ✨

and that's a wrap on version esbuild 0.25.0, dated 2025-02-13 β€” this was ESBUILD-WASM(1), ty for coming to my ted talk πŸŒˆπŸ’…

πŸ“¦ where this page comes from