I had this issue where I was testing the react-router browserHistory
on a webpack-dev-server and when I refresh any of the routes I get something like this Cannot GET /pageurl
In the production case it's a server configuration case as mentioned here , but it's a test and I'm using a development server!
So the solution was so simple! as mentioned in this article all I have to do is to add the following to webpack.config.js
file
devServer: {
port: 8080,
historyApiFallback: true
}
and BAM it works!, alright I just wanted so share this because it wasn't easy to find the solution. bbye.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.