我遇到了一个奇怪的热重载问题,我认为这与我的环境有关,但我无法找到问题所在。我希望其他人遇到了它,并能指出我正确的方向。几天来,我一直在努力解决这个问题。
我在本地(Mac)运行开发 webpack,它与react-boilerplate
启用热重载捆绑在一起。每当 webpack 接收到更改时,它都会重新构建,然后无限获取*.hot-update.json
文件,从而导致页面无限刷新。
来自服务器的日志:
0|web-clie | 2018-02-07 00:30 +00:00: webpack building...
0|web-clie | 2018-02-07 00:30 +00:00: webpack built 665bc020ab09de31dd8e in 372ms
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/1.7dd032a1be4383284dfd.hot-update.js - 1
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/1.7dd032a1be4383284dfd.hot-update.js.map - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 148
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 142
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 138
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 139
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 138
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 141
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 141
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /static/7dd032a1be4383284dfd.hot-update.json - 0
0|web-clie | 2018-02-07 00:30 +00:00: 200 GET /perk/6 - 142
"webpack": "3.5.5",
"webpack-bundle-analyzer": "^2.9.1",
"webpack-dev-middleware": "1.11.0",
"webpack-hot-middleware": "2.18.0",
webpack 配置:https ://gist.github.com/cgray9/0333b4b4278da06a17395c7967ca489a
开发中间件:https ://gist.github.com/cgray9/0333b4b4278da06a17395c7967ca489a
注意:此问题仅在 Chrome 中出现。HMR 在 Safari 中运行良好。
我试过卸载 Chrome 并删除它的所有应用程序文件,但没有成功。