Use Executor Configurations
The configurations
property provides extra sets of values that will be merged into the options map.
project.json
{
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{workspaceRoot}/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.