Skip to content

The @nx/esbuild plugin provides various generators to help you create and configure esbuild projects within your Nx workspace. Below is a complete reference for all available generators and their options.

configuration

Add esbuild configuration to a project.

Examples

Terminal window
nx g @nx/esbuild:configuration my-package

You may also provide a custom main entry file, or a custom tsconfig file if the defaults don’t work. By default, the generator will look for a main file matching src/index.ts or src/main.ts, and a tsconfig file matching tsconfig.app.json or tsconfig.lib.json.

Terminal window
nx g @nx/esbuild:configuration my-package \
--main=packages/my-package/src/entry.ts \
--tsConfig=packages/my-package/tsconfig.custom.json

Usage:

Terminal window
nx generate @nx/esbuild:configuration [options]

Aliases: esbuild-project

Arguments:

Terminal window
nx generate @nx/esbuild:configuration <project> [options]

Options

OptionTypeDescriptionDefault
--buildTargetstringThe build target to add."build"
--formatarrayThe format to build the library (esm or cjs).["esm"]
--importPathstringThe library name used to import it, like @myorg/my-awesome-lib.
--mainstringPath relative to the workspace root for the main entry file. Defaults to <project-root>/src/main.ts or <project-root>src/index.ts, whichever is found.
--platformstringPlatform target for outputs."node"
--skipFormatbooleanSkip formatting files.false
--skipPackageJsonbooleanDo not add dependencies to package.json.false
--skipValidationbooleanDo not perform any validation on existing project.false
--tsConfigstringPath relative to the workspace root for the tsconfig file to build with. Defaults to <project-root>/tsconfig.app.json or <project-root>/tsconfig.lib.json, whichever is found.

Getting Help

You can get help for any generator by adding the --help flag:

Terminal window
nx generate @nx/esbuild:<generator> --help