监听配置
选项名
默认值
类型
说明
watchFile
"fixedPolling"
WatchFileKind
设置监听单个文件时所采用的策略(详见下方策略说明)。
watchDirectory
"useFsEvents"
WatchDirectoryKind
设置监听整个目录时所采用的策略。
fallbackPolling
"fixedInterval"
PollingWatchKind
当无法使用原生文件系统事件(如 inotify/fsevents)时,回退使用的轮询策略。
synchronousWatchDirectory
false
boolean
是否同步监听目录变化(一般不建议,异步监听性能更佳)。
excludeDirectories
[]
string[]
排除某些目录不被监听。支持通配符,例如:["node_modules", "**/__tests__"]。
excludeFiles
[]
string[]
排除某些文件不被监听。例如:["temp.ts", "build/**/*.ts"]。
这有帮助吗?