-1

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.

Alfred
  • 7,071
  • 4
  • 27
  • 35

1 Answers1

0

I found the answer, in webpack.config.json add the following:

devServer: {
  historyApiFallback: true
}
Alfred
  • 7,071
  • 4
  • 27
  • 35