我想在修改或添加新操作时使用webpack HMR重新加载redux reducer并自动重新加载;但是,在我编辑动作文件后,它会显示警告 .
[HMR]意外地要求(811)来自配置的模块76
当这些操作文件中存在错误时,Webpack HMR卡在以下日志中,如何配置webpack以忽略这些错误?
[WDS] App已更新 . 重新编译... [WDS]应用热门更新...
我用的代码:
if(module.hot){
module.hot.accept(); // accepts any JS file change.
module.hot.addStatusHandler(function(status){
if(status === "idle"){
const {appStore} = require('./appStore');
store.replaceReducer(appStore); // reload reducers
}
});
}