Skip to content

Commit

Permalink
perf(nuxt): avoid watching nested paths (#21256)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed May 31, 2023
1 parent bc38ee0 commit a302fe8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions packages/schema/src/config/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')}*.*`
Expand Down

0 comments on commit a302fe8

Please sign in to comment.