為模組啟用 HMR

要使模組符合熱模組替換(HMR)的要求,最簡單的方法是在模組中新增 module.hot.accept(),如下所示:

// ...

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