1

I have a Express server application which is bundled with webpack. The client side is also bundled with webpack and served by the server using webpack-dev-middleware and webpack-hot-middleware for HMR in development mode.

When I change a React component the change happens in the client-side as it should, the problem comes when I started using HMR.

As the components is hot-replaced in the client it utilizes the "new" version of the file, but the server is still stuck with the old one since it was bundled with webpack, therefore when using server-rendering the two results are different. Is there a way to change the server as well when changing a component?

AJ_1310
  • 3,303
  • 3
  • 19
  • 26

1 Answers1

1

try wrapping your server side express code with hot reloading with something like this wrapper:

https://github.com/mdlawson/piping

Piping adds "hot reloading" functionality to node, watching all your project files and reloading when anything changes, without requiring a "wrapper" binary.

Sitian Liu
  • 1,156
  • 10
  • 14