diff --git a/packages/nuxt/src/core/builder.ts b/packages/nuxt/src/core/builder.ts index 3638c84263..9a397d4e9a 100644 --- a/packages/nuxt/src/core/builder.ts +++ b/packages/nuxt/src/core/builder.ts @@ -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()) diff --git a/packages/schema/src/config/common.ts b/packages/schema/src/config/common.ts index a60746a7fe..1e13d6c269 100644 --- a/packages/schema/src/config/common.ts +++ b/packages/schema/src/config/common.ts @@ -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')}*.*`