我有一个快递服务器,在地址上设置了一个热更新文件。 localhost:8080/static/xxx.hot-update.json
. 到目前为止还不错。
("static "是devServer的publicPath。)
在前端,我的js里有这一行。require("webpack-hot-middleware/client?reload=true")
但是它试图在错误的地方查找hot-update文件!它使用的是当前的url,而不是 "static"。它使用的是当前的url,而不是 "静态"。如果我的页面是localhost:8080foo,它就会尝试去获取 localhost:8080/foo/xxx.hot-update.json
显然是失败的。
如果我尝试添加一个路径。require("webpack-hot-middleware/client?path=/static/&reload=true")
就会出现404错误。cannot find localhost:8080/static/
我知道我少了一个小参数... 但我找不到它是什么。
非常感谢你能给的任何帮助:)
最好的!
缺少的一点是,我需要添加同样的代码。publicPath
遍地 output:{}
webpack的配置设置