mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
feat(nuxt): add chokidar watcher debug timing (#20176)
This commit is contained in:
parent
163913a744
commit
811bf28068
@ -44,6 +44,10 @@ export async function build (nuxt: Nuxt) {
|
||||
}
|
||||
|
||||
function watch (nuxt: Nuxt) {
|
||||
if (nuxt.options.debug) {
|
||||
console.time('[nuxt] builder:chokidar:watch')
|
||||
}
|
||||
|
||||
const watcher = chokidar.watch(nuxt.options._layers.map(i => i.config.srcDir as string).filter(Boolean), {
|
||||
...nuxt.options.watchers.chokidar,
|
||||
cwd: nuxt.options.srcDir,
|
||||
@ -55,6 +59,10 @@ function watch (nuxt: Nuxt) {
|
||||
]
|
||||
})
|
||||
|
||||
if (nuxt.options.debug) {
|
||||
watcher.on('ready', () => console.timeEnd('[nuxt] builder:chokidar:watch'))
|
||||
}
|
||||
|
||||
watcher.on('all', (event, path) => nuxt.callHook('builder:watch', event, normalize(path)))
|
||||
nuxt.hook('close', () => watcher.close())
|
||||
return watcher
|
||||
|
Loading…
Reference in New Issue
Block a user