Reputation: 7091
I have a SPA with pretty url navigation (/link
instead of #link
). It works fine as long as I start on the root and navigate around from there but if I go directly to /link
in the browser I get Cannot GET /link
.
How do I rewrite all requests to go to the main script file?
I've read through the webpack-dev-server docs but can't find anything.
Upvotes: -1
Views: 129
Reputation: 7091
I found the answer, in webpack.config.json
add the following:
devServer: {
historyApiFallback: true
}
Upvotes: 0