VS Code has three separate settings that matter here, and using only one isn't enough for real performance gains:
| Setting | What it does |
|---|---|
files.exclude |
Hides files from the Explorer sidebar |
search.exclude |
Skips files during search (Ctrl+Shift+F) |
files.watcherExclude |
Stops the file watcher — biggest perf win |
Recommended config
Put this in your workspace .vscode/settings.json (not global, since it's project-specific):
{
"files.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/build": true,
"**/.next": true,
"**/.nuxt": true,
"**/coverage": true,
"**/.turbo": true,
"**/.cache": true,
"**/logs": true
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/build": true,
"**/.next": true,
"**/coverage": true,
"**/package-lock.json": true,
"**/yarn.lock": true,
"**/pnpm-lock.yaml": true
},
"files.watcherExclude": {
"**/node_modules/**": true,
"**/dist/**": true,
"**/build/**": true,
"**/.next/**": true,
"**/.nuxt/**": true,
"**/coverage/**": true,
"**/.turbo/**": true,
"**/.cache/**": true,
"**/logs/**": true
}
}
Key points
-
`/node_modules
** (with/) matchesnode_modules` at **any depth — so it coversapps/web/node_modules,packages/api/node_modules, etc. -
files.watcherExcludeneeds a trailing `/`** — it watches directories, not the folder itself. Different syntax from the other two. -
Don't exclude
node_modulesfromfiles.watcherExcludeif you rely on auto-install / pnpm linking feedback — usually it's fine, but if you use TypeScript project references withnode_modulessymlinks, remove that line.
Optional: if you use VS Code Workspaces
If your monorepo is large, use a .code-workspace file instead of opening the root:
{
"folders": [
{ "path": "apps/web" },
{ "path": "apps/api" },
{ "path": "packages/shared" }
],
"settings": {
"files.watcherExclude": {
"**/node_modules/**": true,
"**/dist/**": true
}
}
}
This way VS Code only indexes the folders you actually work in, which is the biggest performance boost for multi-app projects.
Verify it worked
Open Command Palette → Developer: Show Running Extensions or Help → Toggle Developer Tools → Console, and check for file-watcher warnings. On Linux you may also need:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Top comments (0)