webpack Hot Module Replacement Enable HMR for Module


Example

To make a module eligible for Hot Module Replacement (HMR), the simplest way is to add module.hot.accept() inside the module, like this:

// ...

if(module.hot) {
    module.hot.accept(); // This will make current module replaceable
}