NX runs unnecessary tasks when building app while using buildLibsFromSource=true #23402
Replies: 3 comments 1 reply
-
If Perhaps the generated angular configuration should overwrite the dependsOn config from nx.json in project.json. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your response! I'm not quite sure what kind of projects rely on build-dependencies being run when the default is I guess one could have a UI library which creates some files (properly referenced in "outputs") which are then required by the app (generating/downloading graphics, icons?)... but then again, the project isn't really "built from the source" but currently it would work. Maybe it's best to update the documentation or to build in some warnings or suggestions on how NX users could potentially improve their build speed? Or announce to think about removing to flag altogether to see how many users will speak up ;-) |
Beta Was this translation helpful? Give feedback.
-
I agree that this sometimes does not make sense 🙂 There is however an issue with further dependencies. Let's say I have an app
Such that Perhaps users should be expected to know this and set up their I've converted the issue to a discussion though so it can be discussed further |
Beta Was this translation helpful? Give feedback.
-
Current Behavior
When I'm running a production build of an app with
buildLibsFromSource: true
, NX will still run all other "build" targets from the buildable libraries because of the target defaults. But if I understand correctly they wouldn't need to be built at all because the app and the libs are built from the source anyway.According to https://nx.dev/nx-api/angular/executors/dev-server#buildlibsfromsource the default is buildLibsFromSource=true but also having "build" depend on "^build" is the default in nx.json. I guess changing this could improve build times for a lot of people, wouldn't it? In the end each buildable library used @nx/angular:ng-packagr-lite which produces something which is not used by default..
So finally, I removed "dependsOn": ["^build"], in the targetDefaults just to see.. and it still works..
Did I miss something fundamental here?
Edit:
In real life I have 170+ buildable libraries. I thought I'd profit from the incremental build by later setting
buildLibsFromSource: false
but NX will (or needs to) check if every library is updated (even checking the cache will be slow with so many projects). We have a lot of separate libraries to get more out of NX affected (i.e. by only running affected Cypress component tests).Expected Behavior
When buildLibsFromSource is
true
(which it is by default) a prod build shouldn't execute all other depending libraries "build"-target. Or add a hint in the documentation on how it is supposed to work and how to work around it (in a supported manner).GitHub Repo
https://github.com/mirobo/nx-angular-tailwind
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions