Enable HMR in dev server

This commit is contained in:
Pete Richards 2018-08-08 13:48:17 -07:00
parent 0fa09e31a6
commit 9c0d5f7dbf
2 changed files with 19 additions and 4 deletions

22
app.js
View File

@ -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) {

View File

@ -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": {