From cd04ac455745f7bdbb6fd29e192a49f067235d7f Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 20 Oct 2021 01:32:19 +0800 Subject: [PATCH] "dist/index.html" is no longer needed for development environment --- server/server.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/server.js b/server/server.js index d5f2d373..1846fe6e 100644 --- a/server/server.js +++ b/server/server.js @@ -157,7 +157,17 @@ let needSetup = false; * Cache Index HTML * @type {string} */ -let indexHTML = fs.readFileSync("./dist/index.html").toString(); +let indexHTML = ""; + +try { + indexHTML = fs.readFileSync("./dist/index.html").toString(); +} catch (e) { + // "dist/index.html" is not necessary for development + if (process.env.NODE_ENV !== "development") { + console.error("Error: Cannot find 'dist/index.html', did you install correctly?"); + process.exit(1); + } +} exports.entryPage = "dashboard";