mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +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 * as vite from 'vite'
|
||||||
import vuePlugin from '@vitejs/plugin-vue'
|
import vuePlugin from '@vitejs/plugin-vue'
|
||||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
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 fse from 'fs-extra'
|
||||||
import { debounce } from 'perfect-debounce'
|
import { debounce } from 'perfect-debounce'
|
||||||
import { withoutTrailingSlash } from 'ufo'
|
import { withoutTrailingSlash } from 'ufo'
|
||||||
@ -71,6 +71,9 @@ export async function buildServer (ctx: ViteBuildContext) {
|
|||||||
rollupWarn(warning)
|
rollupWarn(warning)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
exclude: ctx.nuxt.options.ignore
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
@ -176,7 +179,7 @@ export async function buildServer (ctx: ViteBuildContext) {
|
|||||||
// Watch
|
// Watch
|
||||||
viteServer.watcher.on('all', (_event, file) => {
|
viteServer.watcher.on('all', (_event, file) => {
|
||||||
file = normalize(file) // Fix windows paths
|
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()
|
doBuild()
|
||||||
})
|
})
|
||||||
// ctx.nuxt.hook('builder:watch', () => doBuild())
|
// ctx.nuxt.hook('builder:watch', () => doBuild())
|
||||||
|
Loading…
Reference in New Issue
Block a user