[rush] Putting `pnpm-store` inside the project folder causes high CPU usage when a Rush project is opened in VS Code
Summary
I noticed that my CPU usage is unusually high whenever I open a Rush project inside VS Code without doing anything.
Repro steps
- Create a Rush project.
- Install ~180 dependencies in it (this is the number of dependencies we have in our project).
- Open a Rush project in VS Code.
Expected result: CPU usage shouldn’t significantly increase (e.g. consistently above 100%).
Actual result: High CPU usage, CPU temperature rises.
Details
This is caused by VS Code’s file watcher trying to watch files in common/temp/pnpm-store. Unlike node_modules, VS Code does not exclude this path by default, and thus attempts to watch every single file. In our project, this causes 79,000+ files to be watched, resulting in high CPU usage.
By adding this to .vscode/settings.json, the problem is resolved.
{
"files.watcherExclude": {
"**/pnpm-store/**": true
}
}

Maybe rush init should add the above configuration when generating a new project.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
5.63.1 |
rushVersion from rush.json? |
5.63.1 |
useWorkspaces from rush.json? |
false |
| Operating system? | Mac |
| Would you consider contributing a PR? | No |
Node.js version (node -v)? |
v16.15.0 |
Ideally all of common/temp should probably be ignored by the vscode watcher