Skip to content

CLI ​

The xbuild command builds the entry points given on the command line or in xbuild.config.ts.

Basic Usage ​

bash
xbuild [file] [options]
  • file (positional): the entry point to build. Falls back to esbuild.entryPoints from the config file.

Options ​

OptionAliasTypeDescription
--typeCheck--tcbooleanPerform type checking only.
--node-nbooleanBuild for the Node.js platform.
--dev-darrayEntry points to build and run in Node.js.
--debug--dbarrayEntry points to run in Node.js with the debugger.
--serve-sbooleanServe the build folder over HTTP.
--outdir-ostringOutput directory.
--declaration--debooleanEmit TypeScript declaration files.
--watch-wbooleanWatch for file changes.
--config-cstringBuild configuration file. Default: xbuild.config.ts.
--tsconfig--tscstringTypeScript configuration file. Default: tsconfig.json.
--minify-mbooleanMinify the output.
--bundle-bbooleanBundle the output.
--noTypeChecker--ntcbooleanSkip TypeScript type checking.
--buildOnError--boebooleanContinue building even on TypeScript errors.
--format-fstringOutput format: cjs, esm, or iif.
--version-vbooleanShow the version number.
--help-hbooleanShow help.

Examples ​

bash
# Bundle and minify to dist/ as ESM
xbuild src/index.ts -o dist --bundle --format esm --minify

# Type-check only
xbuild --typeCheck

# Build and run during development, rebuilding on changes
xbuild -w -d src/index.ts

# Use an alternative config file
xbuild -c build/xbuild.config.ts

CLI flags override the corresponding fields of xbuild.config.ts.

See also ​

Released under the Mozilla Public License 2.0