Skip to content

Commit bacf85a

Browse files
committed
Switching to webpack-serve. There were a number of hot reload issues with WDS
Webpack Dev Server had some bad issues with their websocket for hot reloading setup. They made some assumptions about what the servers base URL, HOST, and PORT and this was *not* configurable by the user. This made the hot reloading features fail hard when used through a proxy like insights-proxy See: webpack/webpack-dev-server#1289 webpack-serve does not have these same issues
1 parent 0d4f0c6 commit bacf85a

File tree

4 files changed

+1211
-750
lines changed

4 files changed

+1211
-750
lines changed

config/webpack.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,23 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33
const config = require('./webpack.common.js');
44
const { resolve } = require('path');
55
const pkg = require('../package.json');
6+
const history = require('connect-history-api-fallback');
7+
const convert = require('koa-connect');
68

79
const webpack_config = {
810
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
911
devtool: false,
12+
serve: {
13+
content: config.paths.public,
14+
port: 8002,
15+
dev: {
16+
publicPath: '/insights'
17+
},
18+
// https://github.com/webpack-contrib/webpack-serve/blob/master/docs/addons/history-fallback.config.js
19+
add: (app, middleware, options) => {
20+
app.use(convert(history({})));
21+
},
22+
},
1023
optimization: {
1124
minimize: process.env.NODE_ENV === 'production',
1225
splitChunks: {
@@ -67,6 +80,5 @@ const webpack_config = {
6780

6881
module.exports = merge({},
6982
webpack_config,
70-
require('./webpack.plugins.js'),
71-
require('./webpack.server.js')
83+
require('./webpack.plugins.js')
7284
);

config/webpack.server.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)