Speed up NodeJS server-side development with Webpack 4 + HMR.

When webpack 4.0 came out, I decided to migrate my codebase implementing webpack for the frontend to webpack 4.0.

One thing I hadn’t invested time to do however, is to enable HMR in my backend code. I have a project that takes approx 30 seconds to start up, mainly because of babel transpiling my whole codebase on memory before running my server, which takes a lot of time and resources. In production, I was using babel-node to transpile my entire code before actually running the backend server.

I decided to use webpack for my backend server and I achieved to speed up compilation by 40x.

Continue reading