Workspace Executors

In Nx 13.10+, local nx plugins can contain executors that are used in the workspace. When creating a custom executor for your workspace, look into the local executor guide to simplify the build process.

Converting workspace executors to local executors

  • If you don't already have a local plugin, use Nx to generate one:

โฏ

# replace `latest` with the version that matches your Nx version

โฏ

npm install @nx/plugin@latest

โฏ

nx g @nx/plugin:plugin my-plugin

Nx 15 and lower use @nrwl/ instead of @nx/
  • Use the Nx CLI to generate the initial files needed for your executor. Replace my-executor with the name of your workspace executor.

โฏ

nx generate @nx/plugin:executor my-executor --project=my-plugin

Nx 15 and lower use @nrwl/ instead of @nx/
  • Copy the code for your workspace executor into the newly created executor's folder. e.g. libs/my-plugin/src/executors/my-executor/

  • Now you can reference the executor like this:

1{ 2 "executor": "@my-org/my-plugin:my-executor" 3} 4