fix(cli): don't let changes within buildDir trigger nuxt reload (#420)

This commit is contained in:
Daniel Roe 2021-08-09 14:01:08 +01:00 committed by GitHub
parent bf3f72e24e
commit 52a2fff31c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,10 @@ export default defineNuxtCommand({
const dLoad = debounce(load, 250)
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
watcher.on('all', (_event, file) => {
// Ignore any changes to files within the Nuxt build directory
if (file.includes(currentNuxt.options.buildDir)) {
return
}
if (file.includes('nuxt.config') || file.includes('modules') || file.includes('pages')) {
dLoad(true)
}