How to tell webpack dev server to serve index.html for any route

后端 未结 10 2081
心在旅途
心在旅途 2020-11-28 22:00

React router allows react apps to handle /arbitrary/route. In order this to work, I need my server to send the React app on any matched route.

But webpa

10条回答
  •  醉酒成梦
    2020-11-28 22:23

    I found the easiest solution to include a small config:

      devServer: {
        port: 3000,
        historyApiFallback: {
          index: 'index.html'
        }
      }
    

    I found this by visiting: PUSHSTATE WITH WEBPACK-DEV-SERVER.

提交回复
热议问题