From 9c0d5f7dbf130c59c5c6b9b6e2e1f0aac2c13dbd Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 8 Aug 2018 13:48:17 -0700 Subject: [PATCH] Enable HMR in dev server --- app.js | 22 ++++++++++++++++++---- package.json | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 5fcbe8958c..de0a263af2 100644 --- a/app.js +++ b/app.js @@ -42,15 +42,29 @@ app.use('/proxyUrl', function proxyRequest(req, res, next) { const webpack = require('webpack'); const webpackConfig = require('./webpack.config.js'); +webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); + +webpackConfig.entry.openmct = [ + 'webpack-hot-middleware/client', + webpackConfig.entry.openmct +]; + const compiler = webpack(webpackConfig); -const webpackDevRoute = require('webpack-dev-middleware')( - compiler, { + +app.use(require('webpack-dev-middleware')( + compiler, + { publicPath: '/dist', logLevel: 'warn' } -); +)); -app.use(webpackDevRoute); +app.use(require('webpack-hot-middleware')( + compiler, + { + + } +)); // Expose index.html for development users. app.get('/', function (req, res) { diff --git a/package.json b/package.json index 0313508174..85a91fb4ce 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "webpack": "^4.16.2", "webpack-cli": "^3.1.0", "webpack-dev-middleware": "^3.1.3", + "webpack-hot-middleware": "^2.22.3", "zepto": "^1.2.0" }, "scripts": {