Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deploy ant-design-pro under subfolder? #274

Closed
happier2 opened this issue Nov 23, 2017 · 3 comments
Closed

How to deploy ant-design-pro under subfolder? #274

happier2 opened this issue Nov 23, 2017 · 3 comments

Comments

@happier2
Copy link
Contributor

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?

@afc163
Copy link
Member

afc163 commented Nov 23, 2017

Try this remix-run/react-router#353 (comment)

@happier2
Copy link
Contributor Author

happier2 commented Nov 23, 2017

@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:

<LocaleProvider locale={zhCN}>
<Router history={history}>
<Switch>
<Route path="/user" render={props => <UserLayout {...props} {...passProps} />} />
<Route path="/" render={props => <BasicLayout {...props} {...passProps} />} />
</Switch>
</Router>
</LocaleProvider>

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!

@yoyo837
Copy link
Contributor

yoyo837 commented Jun 19, 2018

当下的pro master模板如何使用publicPath呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants