fix(nuxi): ignore buildDir on windows too (#3999)

This commit is contained in:
Daniel Roe 2022-03-31 17:09:57 +01:00 committed by GitHub
parent fdd6a91a51
commit e4956c555f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { resolve, relative } from 'pathe'
import { resolve, relative, normalize } from 'pathe'
import chokidar from 'chokidar'
import { debounce } from 'perfect-debounce'
import type { Nuxt } from '@nuxt/schema'
@ -73,7 +73,7 @@ export default defineNuxtCommand({
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
watcher.on('all', (event, file) => {
if (!currentNuxt) { return }
if (file.startsWith(withTrailingSlash(currentNuxt.options.buildDir))) { return }
if (normalize(file).startsWith(withTrailingSlash(normalize(currentNuxt.options.buildDir)))) { return }
if (file.match(/(nuxt\.config\.(js|ts|mjs|cjs)|\.nuxtignore|\.env|\.nuxtrc)$/)) {
dLoad(true, `${relative(rootDir, file)} updated`)
}