From 5b3dc23cd391afa7f9bdaf8c7e3b4f9bb9bb122b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 12 Dec 2016 15:01:30 +0100 Subject: [PATCH] Avoid crashing server when config changed --- bin/nuxt-dev | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/nuxt-dev b/bin/nuxt-dev index e6c3805b46..faa4f6712f 100755 --- a/bin/nuxt-dev +++ b/bin/nuxt-dev @@ -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)