I use express server and I set reload option to true:
var webpackDevMiddleware = require("webpack-dev-middleware");
var webpackHotMiddleware = require('webpack-hot-middleware');
var webpack = require("webpack");
var webpackConfig = require("./webpack.config");
var compiler = webpack(webpackConfig);
app.use(webpackDevMiddleware(compiler, {
watchOptions: {
aggregateTimeout: 300,
poll: true
},
publicPath: webpack_config.output.publicPath,
stats: {colors: true},
}));
app.use(webpackHotMiddleware(compiler, {
log: console.log,
path: '/__webpack_hmr',
reload : true
}));
I get a warning after code changes:
[HMR] The following modules couldn't be hot updated: (Full reload needed)
This is usually because the modules which have changed (and their parents) do not know how to hot reload themselves. See http://webpack.github.io/docs/hot-module-replacement-with-webpack.html for more details.
the warning is clear but the I can not see any full page reload in case my module does not support HMR, somehow the performReload function is never called? why?
here is my log:
[HMR] connected
client.js:108 [HMR] bundle rebuilding
client.js:110 [HMR] bundle rebuilt in 388ms
process-update.js:27 [HMR] Checking for updates on the server...
process-update.js:61 [HMR] The following modules couldn't be hot updated: (Full reload needed)
This is usually because the modules which have changed (and their parents) do not know how to hot reload themselves. See http://webpack.github.io/docs/hot-module-replacement-with-webpack.html for more details.
process-update.js:69 [HMR] - ./client/src/components/model/components/f1/index.html
The reload config needs to be set on the client in webpack config - using the querystring of the entry item: https://github.com/glenjamin/webpack-hot-middleware#config
Just to give an example:
...
export default validate(merge(baseConfig, {
debug: true,
devtool: 'eval-source-map',
entry: [
`webpack-hot-middleware/client?path=http://localhost:${port}/__webpack_hmr&reload=true`,
'babel-polyfill',
'./app/styles/main.less',
'./app/index'
],
...
Most helpful comment
Just to give an example: