mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
Merge remote-tracking branch 'nuxt/dev' into dev
This commit is contained in:
commit
1788de42fb
14
bin/nuxt-dev
14
bin/nuxt-dev
@ -69,15 +69,23 @@ _.defaultsDeep(nuxtConfig, { watchers: { chokidar: { ignoreInitial: true } } })
|
|||||||
|
|
||||||
// Start dev
|
// Start dev
|
||||||
let dev = startDev()
|
let dev = startDev()
|
||||||
|
let needToRestart = false
|
||||||
|
|
||||||
// Start watching for nuxt.config.js changes
|
// Start watching for nuxt.config.js changes
|
||||||
chokidar
|
chokidar
|
||||||
.watch(nuxtConfigFile, nuxtConfig.watchers.chokidar)
|
.watch(nuxtConfigFile, nuxtConfig.watchers.chokidar)
|
||||||
.on('all', _.debounce(() => {
|
.on('all', () => {
|
||||||
debug('[nuxt.config.js] changed')
|
debug('[nuxt.config.js] changed')
|
||||||
|
needToRestart = true
|
||||||
|
|
||||||
|
dev = dev.then((nuxt) => {
|
||||||
|
if (needToRestart === false) return nuxt
|
||||||
|
needToRestart = false
|
||||||
|
|
||||||
debug('Rebuilding the app...')
|
debug('Rebuilding the app...')
|
||||||
dev = dev.then(startDev)
|
return startDev(nuxt)
|
||||||
}), 2500)
|
})
|
||||||
|
})
|
||||||
|
|
||||||
function startDev(oldNuxt) {
|
function startDev(oldNuxt) {
|
||||||
// Get latest environment variables
|
// Get latest environment variables
|
||||||
|
@ -449,10 +449,16 @@ export default class Builder {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Server, build and watch for changes
|
// Server, build and watch for changes
|
||||||
compiler.watch(this.options.watchers.webpack, (err) => {
|
const watching = compiler.watch(this.options.watchers.webpack, (err) => {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (err) return reject(err)
|
if (err) return reject(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Stop watching on nuxt.close()
|
||||||
|
this.nuxt.hook('close', () => {
|
||||||
|
watching.close()
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// --- Production Build ---
|
// --- Production Build ---
|
||||||
|
@ -107,7 +107,7 @@ export function wp(p = '') {
|
|||||||
export function wChunk(p = '') {
|
export function wChunk(p = '') {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
return p.replace(/\\/g, '/')
|
return p.replace(/\//g, '_')
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user