Webpack dev server only hot reloads on docker

  docker, reactjs, webpack-dev-server

I have a piece of code that can run on docker or locally.
The hot reload is only working on docker for some reason.

The code is obviously the same and the content is hosted and served properly with webpack dev server. There is no port errors for the hot reload and both solutions are using the same host port.

What could it be?

Here are the differences:

HOST: ubuntu with node v14.1.0

CONTAINER: node:14.0.0-alpine3.10

The command used to run is:

webpack-dev-server –config webpack/webpack.dev.js –hot

And the webpack relevant part is

module.exports = {
  mode: "development",
  devServer: {
    historyApiFallback: true,
    host: "",
    publicPath: "/",
    allowedHosts: ["", "localhost", "*"],
    port: process.env.port || 3001
  watch: true

And the package versions are:

  • “react-hot-loader”: “^4.12.20”,
  • “webpack”: “^4.42.1”,
  • “webpack-cli”: “^3.3.11”,
  • “webpack-dev-server”: “^3.10.3”

I can’t think why it would only work on the docker and not on the host if anything I would expect the reverse.

Source: StackOverflow