Use Executor Configurations
The configurations
property provides extra sets of values that will be merged into the options map.
1{
2 "build": {
3 "executor": "@nrwl/js:tsc",
4 "outputs": ["dist/libs/mylib"],
5 "dependsOn": ["^build"],
6 "options": {
7 "tsConfig": "libs/mylib/tsconfig.lib.json",
8 "main": "libs/mylib/src/main.ts"
9 },
10 "configurations": {
11 "production": {
12 "tsConfig": "libs/mylib/tsconfig-prod.lib.json"
13 }
14 }
15 }
16}
17
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:
1require(`@nrwl/jest`).executors['jest']({
2 ...options,
3 ...selectedConfiguration,
4 ...commandLineArgs,
5}); // Pseudocode
6
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