DEV Community

Shahriar Kabir
Shahriar Kabir

Posted on

Excluding Large Folders in VS Code for Monorepos

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
  }
}
Enter fullscreen mode Exit fullscreen mode

Key points

  • `/node_modules** (with /) matches node_modules` at **any depth — so it covers apps/web/node_modules, packages/api/node_modules, etc.
  • files.watcherExclude needs a trailing `/`** — it watches directories, not the folder itself. Different syntax from the other two.
  • Don't exclude node_modules from files.watcherExclude if you rely on auto-install / pnpm linking feedback — usually it's fine, but if you use TypeScript project references with node_modules symlinks, 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
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Top comments (0)