Open prewk opened 8 months ago
hmm this shouldn't happen, you're right. Is nx/cache
part of your .gitignore
?
No, because we're using zero-install so all the dependencies are checked into git.
It seems to me like IntelliJ is picking up everything for indexing so it makes sense that it reindexes whenever a file in there changes.
Adding it to .gitignore
or manually exempting the folder from indexing seems like the easiest solution... Can you check whether that fixes it?
whenever a file in there changes.
But it doesn't change! You can sit and cmd/alt+tab between the IDE and something else doing nothing. And VS Code also has the problem.
Nothing is touching that directory (as evident by chokidar), only when nx-console is enabled, the touching starts.
.gitignore
Not an option unfortunately, the point is to not have it ignored in git
manually exempting
Doesn't change anything unfortunately.
hmmm it makes sense that things in .nx/cache
(not yarn/cache
) change though. Once nx console starts, it starts the Nx Language Server which does all kinds of calculations about your workspace. These nx/cache/project-graph.json
files that chokidar logs are byproducts of that. So .nx/cache
definitely shouldn't be checked into git and should be ignored.
As to the yarn files that change though, that's an interesting thing I'm not sure how it happens...
Ah yes, .nx is completely git ignored. It's .yarn/cache that's the problem here :)
I've been able to reproduce this and I'll have an improvement in a PR soon.
I'm still not quite sure why the files in .yarn/cache
keep changing but I've excluded them from the file watcher. That will solve a lot of performance issues but not the reindexing.
I'm in contact with the webstorm team to figure out what's happening here - because .yarn/cache
is marked as excluded, changes inside it shouldn't lead to reindexing.
Great!
because .yarn/cache is marked as excluded, changes inside it shouldn't lead to reindexing.
A note here - it's the plugin that performs the changes/touching. It's obvious if you monitor with chokidar (see my OP)
yeah I know. We read the files to figure out what dependencies contain generators & executors so we can show them in Nx Console. So it makes sense that Nx Console is involved. There's two questions:
.yarn/cache
is marked as excluded
Current Behavior
When I enable the plugin in WebStorm, it keeps causing reindexations over and over again. I just need to switch out of WebStorm (triggering a WebStorm save I suppose?) and come back, and - reindexation!
My colleague who uses the plugin in VS Code has a similar problem (but VSC doesn't auto-save).
Turning the plugin off, this problem disappears.
Expected Behavior
It shouldn't reindex.
Steps to Reproduce
I've converted our classic yarn project to a latest (v4) yarn PNP project with zero-installs.
Meaning, instead of a
node_modules
we have all the packages checked into git in.yarn/cache
.Starting WebStorm or VS Code with nx-console enabled. Change a file and bam - reindexing.
Failure Logs / Images / Videos
I'm monitoring changed files with chokidar:
chokidar "*.*" "**/*.*" -c "echo '{path}'"
With nx-console plugin turned off:
With nx-console plugin turned on:
Environment
nx report (also tried on latest nx with same results):