--prod modifier breaks dependsOn targets
See original GitHub issueCurrent Behavior
I have special target for running before build/serve, it works fine for non-prod builds but fails with --prod in Nx workspace.
Expected Behavior
Build modifiers should not break
Steps to Reproduce
{
"root": "apps/recon",
"sourceRoot": "apps/recon/src",
"projectType": "application",
"targets": {
"git-info": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "npm run write-git-info",
"forwardAllArgs": false
}
]
}
},
"build": {
"executor": "@nrwl/web:webpack",
"outputs": ["{options.outputPath}"],
"options": {... },
"dependsOn": [
{
"target": "git-info",
"projects": "self"
}
],
"configurations": {
"production": {... }
}
},
"serve": {...},
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/recon/**/*.{ts,tsx,js,jsx}"]
},
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/apps/recon"],
"options": {
"jestConfig": "apps/recon/jest.config.js",
"passWithNoTests": true
}
}
},
"tags": []
}
This command works
npx nx build recon
this command does not work
npx nx build recon --prod
Failure Logs
> NX ERROR Cannot find configuration ‘production’ for project ‘recon:git-info’
Environment
NX Report complete - copy this into the issue template
Node : 14.18.1
OS : win32 x64
npm : 6.14.15
nx : undefined
@nrwl/angular : undefined
@nrwl/cli : 13.4.3
@nrwl/cypress : 13.4.3
@nrwl/devkit : 13.4.3
@nrwl/eslint-plugin-nx : 13.4.3
@nrwl/express : 13.4.3
@nrwl/jest : 13.4.3
@nrwl/linter : 13.4.3
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : 13.4.3
@nrwl/nx-cloud : undefined
@nrwl/react : 13.4.3
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.4.3
@nrwl/web : 13.4.3
@nrwl/workspace : 13.4.3
@nrwl/storybook : 13.4.3
@nrwl/gatsby : undefined
typescript : 4.5.4
rxjs : 6.6.7
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Troubleshooting .NET Framework Targeting Errors - MSBuild
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects...
Read more >Improving the speed of incremental builds - Apple Developer
When a target has many dependencies, or when it depends on large, monolithic modules, Xcode must serialize more tasks. To improve build performance,...
Read more >Contexts and Dependency Injection - Quarkus
By default, CDI beans are created lazily, when needed. What exactly "needed" means depends on the scope of a bean. A normal scoped...
Read more >Genome Engineering With Zinc-Finger Nucleases - PMC - NCBI
Stimulating Gene Targeting With Double-Strand Breaks ... While the frequencies of target modification vary, yields in the vicinity of 10% of all targets...
Read more >ENCODE Transcription Factor Targets dataset
CHD genes alter gene expression possibly by modification of chromatin structure thus altering ... The products of target genes it activates are required...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for submitting the issue!
It has been fixed here: https://github.com/nrwl/nx/commit/ccda8cf8160a50edcda99944d589999916eba337 and will be released as part of 13.5.0 tomorrow.
Thank you!
It does feel a little verbose to have to specify an empty config for a target that doesn’t need it, but it could also prevent human-error. It’s like nx is saying “You told me to use the production config, but I don’t see a production config”.
@Lonli-Lokli It sounds to me like you’re saying you want to specify your production config just once and have nx forward it to all targets that the initial target depends on. If all of your targets require the same production configuration settings, then you may want to consider moving those settings to environment variables. That way each script could read from them.
However, I’m not sure if that works for the
"executor": "@nrwl/web:webpack",
, so you would have to specify the config at most twice. As a feature request, it might be handy to be able to do something like:in project.json