Hi, everyone. I want to deploy ant-design-pro under subfolder with using browserHistory instead of hashHistory. This subfolder is '/myapp'. In this way, this entry point would like this:
// entry point
http://localhost:8000/myapp/
//dashboard - analysis
http://localhost:8000/myapp/dashboard/analysis
I look around roadhog tutorial docs and I found out that I should config .roadhogrc by adding:
"publicPath": "/myapp/"
It works out when I visit http://localhost:8000/myapp/. When I jump to other route by clicking navbar, the url changes to http://localhost:8000/list/table-list, which I expected is http://localhost:8000/myapp/list/table-list. How should I figure it out?
Try this https://github.com/ReactTraining/react-router/issues/353#issuecomment-252293393
@afc163 Thanks, I reviewed rearc-router v4 docs. I found out that BrowserRouter with basename props could solve my problem.
I should change code in src/router.js from:
https://github.com/ant-design/ant-design-pro/blob/7532598937198bef0fce344b3521f9e3c5044755/src/router.js#L54-L61
to:
<LocaleProvider locale={zhCN}>
<BrowserRouter basename="myapp">
<Switch>
<Route path="/user" render={props => <UserLayout {...props} {...passProps} />} />
<Route path="/" render={props => <BasicLayout {...props} {...passProps} />} />
</Switch>
</BrowserRouter>
</LocaleProvider>
Solve it!
当下的pro master模板如何使用publicPath呢?
Most helpful comment
当下的pro master模板如何使用publicPath呢?