How to implement Hot module Replacement in Angular 9?

659 Views Asked by At

I am working on a big project and it takes to much time to run that project, so while googling I got an idea of hot module replacement, but I don't know how to implement it so please help me how to implement HRM in angular 9

1

There are 1 best solutions below

1
On

It is not a part of angular 9, it is released with Angular 11 by default. You should upgrade the angular version and ready to use it.

Main reason: Earlier even making a smaller change trigger angular dev server to re-compile and process all the files again which takes time to re-render and re-paint everything with HMR it will be quick. It takes a lot of time based on your system configuration.

HMR is not a angular feature, but it is a webpack feature and bundled in the angular 11 version by default. HMR is to update the application modules without reloading and repainting everything.

How to use it:

ng serve --hmr

You can check here for more details.