Webpack-Hot-Middleware not working with HtmlWebpackPlugin

713 Views Asked by At

Hot module reloading is not working with HtmlWebpackPlugin. I can actually see in console that my files are getting updated but browser does not render updated application.

Relevant Links

Repository: https://github.com/developer239/workbox-webpack-react/tree/ssr Server File: https://github.com/developer239/workbox-webpack-react/blob/ssr/server.js

Webpack Base: https://github.com/developer239/workbox-webpack-react/blob/ssr/webpack.common.js

Webpack Dev: https://github.com/developer239/workbox-webpack-react/blob/ssr/webpack.dev.js

Package.json: https://github.com/developer239/workbox-webpack-react/blob/ssr/package.json

Environment

npm 4.2.0

node 7.10.0

I am trying to figure this one out for hours. Could you please help me out?

1

There are 1 best solutions below

0
On BEST ANSWER

I was confused by official webpack-hot-middleware documentation. Hot middleware client must be in the same entry.

I replaced this:

  entry: {
    hot: 'webpack-hot-middleware/client?http://localhost:3000',
    app: './src/index.js',
  },

With this:

  entry: [
    'webpack-hot-middleware/client?http://localhost:3000',
    './src/index.js',
  ],