webpack-dev-server@1.16.5热重装不能正常工作?

时间:2018-01-17 03:04:01

标签: webpack-dev-server

启动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后窗口的自动刷新,

任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

我通过在window.postMessage之后添加location.reload()暂时解决了窗口重载问题,不确定发布消息" webpackHotUpdate"如果不是来自-hotEmitter.on(" webpackHotUpdate",...- method