Hey guys I was wonderin…

1 minute read

Hey guys, I was wondering: if I have 200 apps and 500 libs in my monorepo, and I add a new app, this would update general implicit depedencies such as nx.json and workspace.json. Meaning the next affected:build will build 701 things (nightmare!) instead of just the only new thing… how can I avoid that?

Responses:

nx.json itself does not need to be an entry in the implicitDependencies?

for us nx.json changes do not trigger affected all.

we dont use workspace.json tho, so can’t answer for that

you can play around with <https://nx.dev/angular/workspace/configuration#implicit-dependencies implicitDependencies> in your nx.json - but I don’t know if it’s recommended to completely remove nx.json and workspace.json from there, as you don’t know how changing them in the future might affect your apps and libs (and cause the need for a rebuild)
enabling caching is great for scenarios like this though! even if nx affected tries to rebuild 700 apps and libs, when it sees that they actually haven’t changed, it will just pull the output from the cache, so the build, even for 700 apps, should hopefully still be very fast! (you can read more <https://blog.nrwl.io/how-to-never-build-or-test-the-same-code-twice-2dc58e413279 here>)
having libs buildable independently helps even more, via<https://nx.dev/angular/guides/ci/incremental-builds#incremental-builds incremental builds>

EDIT: ignore me, just realised caching gets invalid as well when workspace.json changes, sorry :smile:

(sorry Klaas, just saw you mentioned implicitDependencies as well, you’re right, I guess it depends on each workspace what should go in there)

workspace.json or angular.json, same thing :slightly_smiling_face:

ah thx for clarifying William. both are not in our implicitDependencies then

we haven’t had any issue so far, but I guess what mentions might be valid (changes in the future) I guess you could go 2 ways then • either rely on cache (which is very nice) • remove nx.json & workspace.json from the implicitDependencies and just keep an eye on what should happen. Meaning if you all of a sudden see apps/libs not being built when the have … you can change it back

Updated: