You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何Ember默认.watchmanconfig未忽略node_modules?是否存在弊端?

Why Ember's Default .watchmanconfig Doesn't Ignore node_modules?

Great question—this is something tons of Ember developers run into when hitting watchman limits like "too many files" errors. Let’s break this down:

The Logic Behind the Default Config

First, ignoring tmp and dist makes total sense—these are build-generated temporary/output directories, so there’s zero reason to watch for changes there. But why leave node_modules out? There are a few key reasons tied to Ember’s development workflow:

  • Local Ember Addon Development: A lot of Ember developers use npm link or yarn link to connect locally built addons to their main project. If node_modules was ignored by default, watchman wouldn’t pick up changes to the linked addon’s code, meaning you’d have to manually rebuild your main project every time you tweak the addon—total productivity killer.
  • Dynamic Dependency Resources: While rare, some Ember addons dynamically load files from node_modules at runtime (think icon libraries, localization files, or theme assets). The default config avoids breaking these edge cases by not ignoring the directory outright.
  • Ecosystem History & Convention: Ember’s build tooling (like Broccoli) has historically relied on watching certain parts of node_modules for specific workflows. Over time, this became the default behavior to align with common community practices.

The Actual Downsides of Not Ignoring node_modules

That said, there are clear drawbacks to this default:

  • Watchman Limit Errors: Modern node_modules folders can contain tens of thousands of files—easily hitting watchman’s max_files threshold, which triggers errors like Too many open files or inotify limit reached.
  • Wasted System Resources: Watching all those files eats up extra memory and CPU, which can slow down your development environment, especially on lower-powered machines.

What You Can Do About It

If you don’t use local linked addons and don’t have any addons that dynamically load from node_modules, you can safely update your .watchmanconfig to ignore it:

{ "ignore_dirs": ["tmp", "dist", "node_modules"] }

This will immediately fix most watchman limit issues and lighten the load on your system.

内容的提问来源于stack exchange,提问作者Christian Neverdal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:35:57