mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-29 23:02:42 +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]
|
||||
var options = {}
|
||||
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
|
||||
nuxt.close()
|
||||
@ -52,7 +56,7 @@ function listenOnConfigChanges (nuxt, server) {
|
||||
server.nuxt = nuxt
|
||||
})
|
||||
.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)
|
||||
})
|
||||
}, 200)
|
||||
|
Loading…
Reference in New Issue
Block a user