React-router v4, convert hashHistory to browserHistory using webpack

(YeeP) #1

So the subject pretty much says it all. I am trying to convert between the two. Right now all of my main routes in client/app.js work. It’s when I get into the nested routes where I have problems. In addition I cannot type any of the nested routes into the browser (localhost:3000/app/dashboard). They all fail. I have seen many poatings about aetting up an ezpress server with Node to handle this. That is great and probably what I will do when I go to production. At this point I need to have a setup that is running on webpack in a local dev environment.

Anyone have any experience in this conversion? Not at work right now but I will be tomorrow to provide code samples.


(Jed Fox) #2

If you’re using webpack-dev-server, you can set devServer.historyApiFallback to true to respond with the contents of index.html for all routes.