From 4bda0717427d7ace7c1c8a9b7eb8055584ce9417 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 8 Nov 2023 12:18:51 -0500 Subject: [PATCH] Should fix issues starting server first time Using `node scripts/buildHomebrew.js --dev` can sometimes start up the server before the build is complete, so `ssr.js` is not quite ready and the app crashes. This puts the server startup inside the async block to it must await everything else being complete. --- scripts/buildHomebrew.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/buildHomebrew.js b/scripts/buildHomebrew.js index 6706ab591..f072b0359 100644 --- a/scripts/buildHomebrew.js +++ b/scripts/buildHomebrew.js @@ -154,14 +154,14 @@ fs.emptyDirSync('./build'); // build(bundles); // -})().catch(console.error); + //In development, set up LiveReload (refreshes browser), and Nodemon (restarts server) + if(isDev){ + livereload('./build'); // Install the Chrome extension LiveReload to automatically refresh the browser + watchFile('./server.js', { // Restart server when change detected to this file or any nested directory from here + ignore : ['./build', './client', './themes'], // Ignore folders that are not running server code / avoids unneeded restarts + ext : 'js json' // Extensions to watch (only .js/.json by default) + //watch : ['./server', './themes'], // Watch additional folders if needed + }); + } -//In development, set up LiveReload (refreshes browser), and Nodemon (restarts server) -if(isDev){ - livereload('./build'); // Install the Chrome extension LiveReload to automatically refresh the browser - watchFile('./server.js', { // Restart server when change detected to this file or any nested directory from here - ignore : ['./build', './client', './themes'], // Ignore folders that are not running server code / avoids unneeded restarts - ext : 'js json' // Extensions to watch (only .js/.json by default) - //watch : ['./server', './themes'], // Watch additional folders if needed - }); -} +})().catch(console.error); \ No newline at end of file