fix(nuxi): ignore watch events if nuxt instance is not ready

This commit is contained in:
Pooya Parsa 2021-10-18 20:38:46 +02:00
parent 035e9b5e8b
commit 225e3bafd4
1 changed files with 1 additions and 0 deletions

View File

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