All examples of web packages that I looked at now relate to replacing a hot module on the client side, for example: this and this .
According to the webpack document, you can use the EEPER webpack-dev-server OR middlewares (webpack-dev-webpack-dev-middleware and webpack-hot-middleware together with webpack-hot-middleware/client in the config entry and are integrated, for example, in express js) to enable hot swapping of modules for client codes
Is it possible to enable module hot swapping for server codes? This document shows an example.
var requestHandler = require("./handler.js"); var server = require("http").createServer(); server.on("request", requestHandler); server.listen(8080);
The document is quite important for explanation.
So, the question is, how will the module be hot-swapped in server code without restarting the server? (At the moment, I have nodemon observing the server code to restart the server when the file changes)
source share