mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Avoid crashing server when config changed
This commit is contained in:
parent
0c385f522c
commit
5b3dc23cd3
@ -41,7 +41,11 @@ function listenOnConfigChanges (nuxt, server) {
|
|||||||
delete require.cache[nuxtConfigFile]
|
delete require.cache[nuxtConfigFile]
|
||||||
var options = {}
|
var options = {}
|
||||||
if (fs.existsSync(nuxtConfigFile)) {
|
if (fs.existsSync(nuxtConfigFile)) {
|
||||||
options = require(nuxtConfigFile)
|
try {
|
||||||
|
options = require(nuxtConfigFile)
|
||||||
|
} catch (e) {
|
||||||
|
return console.error(e) // eslint-disable-line no-console
|
||||||
|
}
|
||||||
}
|
}
|
||||||
options.rootDir = rootDir
|
options.rootDir = rootDir
|
||||||
nuxt.close()
|
nuxt.close()
|
||||||
@ -52,7 +56,7 @@ function listenOnConfigChanges (nuxt, server) {
|
|||||||
server.nuxt = nuxt
|
server.nuxt = nuxt
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Error while rebuild the app:', error)
|
console.error('Error while rebuild the app:', error) // eslint-disable-line no-console
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
}, 200)
|
}, 200)
|
||||||
|
Loading…
Reference in New Issue
Block a user