react-hot-loader无法正常工作与所有网址

问题描述:

我设法使用react-hot-loader工作来进行基本设置。它适用于任何具有一个/(如localhost:8080/test)的url,但是一旦我添加了另一个斜杠(例如localhost:8080/test/asd),它就会刷新,而不是正确的热更新。该页面仍然显示正常,这只是热负载部分不符合预期。react-hot-loader无法正常工作与所有网址

这是我的设置:https://github.com/severisv/react-hot-loader-example

这是怎么回事?有没有办法解决?

+0

我认为你应该使用反应路由器。 – Blkc

添加publicPath到的WebPack-配置的输出部分解决了这个问题:

output: { 
    ... 
    publicPath: '/' 
},