nx/docs/shared/recipes/use-executor-configurations.md
Isaac Mann e717660102
docs(nx-dev): diataxis restructure (#11649)
* docs(nxdev): restructure docs to diataxis style

* docs(nxdev): cleanup

* docs(nxdev): fix links

* chore(nxdev): format

* docs(nxdev): fix broken images

* docs(nxdev): fix links

* docs(nxdev): fix links

* docs(nxdev): fix links

* docs(nxdev): tweaks

* docs(nxdev): redirect rules

* docs(nxdev): fixes
2022-08-29 08:36:55 -04:00

988 B

Use Executor Configurations

The configurations property provides extra sets of values that will be merged into the options map.

{
  "build": {
    "executor": "@nrwl/js:tsc",
    "outputs": ["dist/libs/mylib"],
    "dependsOn": ["^build"],
    "options": {
      "tsConfig": "libs/mylib/tsconfig.lib.json",
      "main": "libs/mylib/src/main.ts"
    },
    "configurations": {
      "production": {
        "tsConfig": "libs/mylib/tsconfig-prod.lib.json"
      }
    }
  }
}

You can select a configuration like this: nx build mylib --configuration=production or nx run mylib:build:configuration=production.

The following code snippet shows how the executor options get constructed:

require(`@nrwl/jest`).executors['jest']({
  ...options,
  ...selectedConfiguration,
  ...commandLineArgs,
}); // Pseudocode

The selected configuration adds/overrides the default options, and the provided command line args add/override the configuration options.