How to run ng serve with PathLocationStrategy while falling back to index.html when page is refreshed

情到浓时终转凉″ 提交于 2021-02-11 06:48:15

问题


For some reasons (e.g Hiding the # from the user), we would like to use PathLocationStrategy as the routing strategy for our Angular 8 Application.

We are about to fallback to index.html while deploying the application to an Nginx server. But the problem we are facing is, when we run ng serve locally, the application won't bootstrap when page is refreshed.

I have tried to use a custom webpack config to enable devServer.historyApiFallback, it doesn't work.

I have also read through quite a few docs like this, but no luck

Is there any workaround to spin up a local server that supports the PathLocationStrategy better? Thanks!

来源:https://stackoverflow.com/questions/56863628/how-to-run-ng-serve-with-pathlocationstrategy-while-falling-back-to-index-html-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!