为模块启用 HMR

要使模块符合热模块替换(HMR)的要求,最简单的方法是在模块中添加 module.hot.accept(),如下所示:

// ...

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