mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
fix(vite): do not watch ignored pathes (#5632)
This commit is contained in:
parent
6f8b7a9043
commit
67f40d7e40
@ -2,7 +2,7 @@ import { resolve, join, normalize } from 'pathe'
|
||||
import * as vite from 'vite'
|
||||
import vuePlugin from '@vitejs/plugin-vue'
|
||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
||||
import { logger, resolveModule } from '@nuxt/kit'
|
||||
import { logger, resolveModule, isIgnored } from '@nuxt/kit'
|
||||
import fse from 'fs-extra'
|
||||
import { debounce } from 'perfect-debounce'
|
||||
import { withoutTrailingSlash } from 'ufo'
|
||||
@ -71,6 +71,9 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
rollupWarn(warning)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
exclude: ctx.nuxt.options.ignore
|
||||
}
|
||||
},
|
||||
server: {
|
||||
@ -176,7 +179,7 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
// Watch
|
||||
viteServer.watcher.on('all', (_event, file) => {
|
||||
file = normalize(file) // Fix windows paths
|
||||
if (file.indexOf(ctx.nuxt.options.buildDir) === 0) { return }
|
||||
if (file.indexOf(ctx.nuxt.options.buildDir) === 0 || isIgnored(file)) { return }
|
||||
doBuild()
|
||||
})
|
||||
// ctx.nuxt.hook('builder:watch', () => doBuild())
|
||||
|
Loading…
Reference in New Issue
Block a user