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.
Related Documentation
Concepts
Recipes
- Running Custom Commands
- Local Executors
- Compose Executors
- Profiling Build Performance
- Customizing Webpack Config
- Faster Builds with Module Federation