From 07a291a2de7bc7214992a8843104ae1d73328ff3 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Mon, 14 Dec 2020 22:32:15 +0800 Subject: [PATCH] client: properly serve public assets with webpack-dev-server --- client/config/webpackDevServer.config.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/config/webpackDevServer.config.js b/client/config/webpackDevServer.config.js index da701731..6427d092 100644 --- a/client/config/webpackDevServer.config.js +++ b/client/config/webpackDevServer.config.js @@ -1,3 +1,4 @@ +const path = require('path'); const paths = require('../../shared/config/paths'); const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; @@ -6,12 +7,12 @@ const host = process.env.HOST || '0.0.0.0'; const generateConfig = (proxy, allowedHost) => { return { firewall: false, - compress: true, + compress: false, static: [ { - directory: paths.appPublic, + directory: path.resolve(paths.appPublic), staticOptions: {}, - publicPath: paths.appBuild, + publicPath: '/', serveIndex: true, watch: { ignored: /node_modules/, @@ -24,7 +25,7 @@ const generateConfig = (proxy, allowedHost) => { historyApiFallback: true, public: allowedHost, proxy: { - '/api': { + '/api/': { target: proxy, changeOrigin: true, secure: false,