From 593f2d61963cbeffe0f75bc9d1d19a0d5a71e670 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 7 Apr 2020 20:46:45 +0200 Subject: [PATCH] Build fix. --- frontend/app-config/webpack.config.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/app-config/webpack.config.js b/frontend/app-config/webpack.config.js index be6cc60bc..52f127c70 100644 --- a/frontend/app-config/webpack.config.js +++ b/frontend/app-config/webpack.config.js @@ -10,6 +10,14 @@ function root() { return path.join.apply(path, [appRoot].concat(newArgs)); }; +function tryGetFile(file) { + try { + return fs.readFileSync(path.resolve(__dirname, file)); + } catch (ex) { + return undefined; + } +} + const plugins = { // https://github.com/webpack-contrib/mini-css-extract-plugin MiniCssExtractPlugin: require('mini-css-extract-plugin'), @@ -211,8 +219,8 @@ module.exports = function (env) { 'Access-Control-Allow-Origin': '*' }, https: { - key: fs.readFileSync(path.resolve(__dirname, 'localhost-key.pem')), - cert: fs.readFileSync(path.resolve(__dirname, 'localhost.pem')), + key: tryGetFile('localhost-key.pem'), + cert: tryGetFile('localhost.pem'), }, historyApiFallback: true, }