Why can HMR only be used in a development environment, but not in a production environment?

as described in the title


is theoretically possible. For example, on the nodeJs server, you can update the code through hot updates. But there is a problem, that is, being in the watch state all the time will lose a lot of performance. And at a later stage, after the code is stable, the chance of updating is very small, so there is no need to add HMR. And almost all the backends are equipped with PM2,pm2 's reload to update your code seamlessly. You can learn about pm2.


  1. Hot is more likely to cause a lot of psychic problems, which I personally think are mainly memory leaks. Suppose I have an asynchronous method that is halfway through execution, and my code changes the (WTF). Therefore, the backend generally does not even have a hot development environment, but adopts a restart solution such as nodemon , not to mention the generation environment.
  2. as for webpack/javascript in the tag, the production environment only needs a static server (server rendering counts as 1). Now if you want to maintain a ws for each visitor, no one (or server) will allow it.
Menu