expresswebpackhtml-webpack-pluginwebpack-hot-middleware

Webpack-Hot-Middleware not working with HtmlWebpackPlugin


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?


Solution

  • 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',
      ],