browser-sync not working with single page application

854 views Asked by At

I have a single page application that does not use hash URLs I want to use the history API. I am using the middleware historyApiFallback() in browserSync server options. However, this is only working for one level deep URLs:

http://localhost:3000/main correctly resolves to index.html BUT http://localhost:3000/main/a is NOT working. The browser shows "connected to browser sync" and then a blank page is displayed.

Anyone knows what could be the issue here?

1

There are 1 answers

0
Dan On BEST ANSWER

The issue was that the URLs for js and css resources weren't correctly setup. This post helped me fixed the issue: mod_rewrite to index.html breaks relative paths for deep URLs