mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 15:42:09 +00:00
fix(nuxi): ignore watch events if nuxt instance is not ready
This commit is contained in:
parent
035e9b5e8b
commit
225e3bafd4
@ -75,6 +75,7 @@ export default defineNuxtCommand({
|
|||||||
const dLoad = debounce(load, 250)
|
const dLoad = debounce(load, 250)
|
||||||
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
|
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
|
||||||
watcher.on('all', (_event, file) => {
|
watcher.on('all', (_event, file) => {
|
||||||
|
if (!currentNuxt) { return }
|
||||||
if (file.startsWith(currentNuxt.options.buildDir)) { return }
|
if (file.startsWith(currentNuxt.options.buildDir)) { return }
|
||||||
if (file.match(/nuxt\.config\.(js|ts|mjs|cjs)$/)) {
|
if (file.match(/nuxt\.config\.(js|ts|mjs|cjs)$/)) {
|
||||||
dLoad(true, `${relative(rootDir, file)} updated`)
|
dLoad(true, `${relative(rootDir, file)} updated`)
|
||||||
|
Loading…
Reference in New Issue
Block a user