React Router v4 nested routes not work with webpack-dev-server

后端 未结 5 1245
感情败类
感情败类 2021-01-13 06:50

I try to setup nested routes for my react app like this

  • / -> Home Page
  • /about -> About Page
  • /protected
5条回答
  •  既然无缘
    2021-01-13 07:14

    I was having the same problem described in the question (webpack-dev-server not serving nested routes, top level ones working fine). Sadly, neither historyApiFallback: true nor publicPath: '/' were working. Actually, the problem was inside index.html, more precisely inside . Changing to

           
    

    was enough to end the pain.

提交回复
热议问题