-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implicitDependencies
added for a project, cause other projects to build
#9426
Comments
I agree. Creating implicit dependencies for a project should not cause all projects to be affected. Correct me if I'm wrong but this shouldn't impact you after this change is made. This makes it not as severe of an issue. But ideally, yes we should be able to only affect |
Hi @FrozenPandaz, thanks for your reply. The issue I see is that when Though, it sounds like that is intended behaviour? I.e, adding an implicit dependency only changes the projects that are "affected" and not the cache? My use case is that the GraphQL schema changes daily so the workflow for developers on my team is to pull down the latest master and build everything from scratch before starting development, relying on NX Cloud to maximise cache re-use as much as possible. |
We have temporarily got around it by creating a new explicit packages (@namespace/graphql-schema) with a symlink to the GraphQL Schema, and making every package that depends on GraphQL explicitly depend on this package. |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
I am facing the same issue. In my case there are two projects:
where "setup-backend" has a dependency on "backend". The setup incorporates an environment variable that is specified in a ".env" file in the root of the Nx workspace. Thus, we want "setup-backend" to be rebuilt when the ".env" file changes, but "backend" should not be rebuilt in this case. To achieve this, I have specified this dependency in "nx.json": {
"implicitDependencies": {
".env": [
"setup-backend"
]
},
// ...
} Expected behavior: Changing the ".env" file only causes a cache miss in the "setup-backend" project. @FrozenPandaz I understand that adding the implicit dependency causes cache misses in all projects. That's okay. The problem is that changing the ".env" file does this too. Environment
|
I found a workaround for my scenario that avoids the I added a third project called "props" and moved the ".env" file there. (The project has no targets defined.) // setup_backend's project.json
{
"name": "setup-backend",
"root": "setup-backend",
"implicitDependencies": [ "backend", "props" ], // <= dependency on "props" ensures cache invalidation on .env changes
"targets": {
"build": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"envFile": "props/.env", // <= import .env file from other project
"command": "..."
},
"dependsOn": [
{
"projects": "dependencies",
"target": "build"
}
]
}
}
} This way, "setup-backend" gets rebuilt whenever "props/.env" changes, but "backend" does not. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Say I have 3 packages,
a
,b
, andc
.c
depends onb
, which is our GraphQL client.I add an
implicitDependency
on my project's GraphQL schema.json in nx.json as per the docs, like so:I would expect that changing
config/schema.graphql
would not causea
to rebuild, however, I see in Nx Cloud that the GraphQL schema is added to theimplicitDeps
for this project and so whenever the schema changes the cache misses fora
.This is a simplified example, the actual workspace has ~150 projects, and ~50 of them depend on the GraphQL client.
Am I misunderstanding how to use implicit dependencies?
Current Behavior
a
reports a cache miss and rebuilds when the implicit dependency for another project (GraphQL schema) changes.Expected Behavior
a
builds from the cache when the implicit dependency changes.I'm unsure if this is a regression.
Steps to Reproduce
Example repo demonstrates similar behaviour: nrwl/nx-examples#194
Adding implicit dependency on
example-schema.json
forproducts
causes bothproducts
andcart
to build whenexample-schema.json
changes.Failure Logs
Environment
The text was updated successfully, but these errors were encountered: