Fix rebuild when nuxt.config.js changed

This commit is contained in:
Sébastien Chopin 2016-12-14 15:30:44 +01:00
parent b245b8d6ff
commit 0dd867cdec

View File

@ -37,7 +37,7 @@ nuxt.build()
function listenOnConfigChanges (nuxt, server) { function listenOnConfigChanges (nuxt, server) {
// Listen on nuxt.config.js changes // Listen on nuxt.config.js changes
var build = _.debounce(() => { var build = _.debounce(() => {
debug('[nuxt.config.js] changed, rebuilding the app...') debug('[nuxt.config.js] changed')
delete require.cache[nuxtConfigFile] delete require.cache[nuxtConfigFile]
var options = {} var options = {}
if (fs.existsSync(nuxtConfigFile)) { if (fs.existsSync(nuxtConfigFile)) {
@ -50,6 +50,8 @@ function listenOnConfigChanges (nuxt, server) {
options.rootDir = rootDir options.rootDir = rootDir
nuxt.close() nuxt.close()
.then(() => { .then(() => {
nuxt.renderer = null
debug('Rebuilding the app...')
return new Nuxt(options).build() return new Nuxt(options).build()
}) })
.then((nuxt) => { .then((nuxt) => {