fix(nuxi): don't restart when build directory changes (#613)

This commit is contained in:
Daniel Roe 2021-10-02 12:44:51 +01:00 committed by GitHub
parent 2b51af76d8
commit 40d3aae439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,8 @@ export default defineNuxtCommand({
const dLoad = debounce(load, 250)
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
watcher.on('all', (_event, file) => {
if (file.match(/nuxt\.config\.(js|ts|mjs|cjs)$|pages$/)) {
if (file.startsWith(currentNuxt.options.buildDir)) { return }
if (file.match(/nuxt\.config\.(js|ts|mjs|cjs)$/)) {
dLoad(true, `${relative(rootDir, file)} updated`)
}
if (['addDir', 'unlinkDir'].includes(_event) && file.match(/pages$/)) {