启动webpack-dev-server --hot
我看到代码运行到client / index.js:
log("info", "[WDS] App hot update...");
console.log('window object',currentHash); //printed
window.postMessage("webpackHotUpdate" + currentHash, "*");
但不触发dev-server代码:
hotEmitter.on("webpackHotUpdate", function(currentHash) {
console.log('inside weboackHotUpdate'); //not printed
lastHash = currentHash;
console.log('module.hot.status|'+ module.hot.status());
if(!upToDate() && module.hot.status() === "idle") {
log("info", "[HMR] Checking for updates on the server...");
check();
}
});
这会影响hotmodulereplacement后窗口的自动刷新,
任何人都可以帮忙吗?
答案 0 :(得分:0)
我通过在window.postMessage之后添加location.reload()暂时解决了窗口重载问题,不确定发布消息" webpackHotUpdate"如果不是来自-hotEmitter.on(" webpackHotUpdate",...- method