Closed hydrotik closed 8 years ago
Had my ports wrong and needed to fire up the web pack instance for HMR, but for anyone that is having some difficulty with this I am including my code.
webpack.dev.server.hot.js
var path = require('path');
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.hot.config');
new WebpackDevServer(webpack(config), {
contentBase: path.resolve(__dirname, './'),
hot: true,
historyApiFallback: true
}).listen(8080, 'localhost', function (err) {
if (err) {
console.log(err); //eslint-disable-line no-console
}
console.log('Listening at localhost:8080'); //eslint-disable-line no-console
});
In my package.json scripts object
"start": "node server.js",
"watch-client": "node ./webpack.dev.server.hot.js --verbose --colors --display-error-details --config webpack.hot.config.js",
"watch": "node ./node_modules/concurrently/src/main.js --kill-others \"npm run watch-client\" \"npm run start\""
Been battling with this for a while and not sure where to post this. I'm using Hapi 9 and hooking up the webpack plugin and not getting any HMR action. I see a polling error in the browser console:
But I get;
in the console. When I load the Webpack Dev server and point to the same config, HMR works. I'm rendering a jsx on the server side in a views folder in lieu of an index html, which then pulls in the client side React code that should be hot reloading.
server.js
webpack.hot.config.js