perf(nuxt): avoid watching nested paths (#21256)

This commit is contained in:
Daniel Roe 2023-05-31 14:11:46 +01:00 committed by GitHub
parent bc38ee058f
commit a302fe8062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -116,7 +116,7 @@ function createGranularWatcher () {
watchers[path].close()
delete watchers[path]
}
if (event === 'addDir' && path !== dir && !ignoredDirs.has(path) && !(path in watchers) && !isIgnored(path)) {
if (event === 'addDir' && path !== dir && !ignoredDirs.has(path) && !pathsToWatch.includes(path) && !(path in watchers) && !isIgnored(path)) {
watchers[path] = chokidar.watch(path, { ...nuxt.options.watchers.chokidar, ignored: [isIgnored] })
watchers[path].on('all', (event, path) => nuxt.callHook('builder:watch', event, normalize(path)))
nuxt.hook('close', () => watchers[path].close())

View File

@ -357,6 +357,7 @@ export default defineUntypedSchema({
'**/*.d.ts', // ignore type declarations
'.output',
'.git',
'.cache',
await get('analyzeDir'),
await get('buildDir'),
await get('ignorePrefix') && `**/${await get('ignorePrefix')}*.*`