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

Make automatically added trailing slash in base optional #2865

Closed
tychenjiajun opened this issue Aug 1, 2019 · 5 comments
Closed

Make automatically added trailing slash in base optional #2865

tychenjiajun opened this issue Aug 1, 2019 · 5 comments

Comments

@tychenjiajun
Copy link

tychenjiajun commented Aug 1, 2019

What problem does this feature solve?

We use the following base config

base: /page/index.html

what we want in href generated by

<a href="/page/index.html#/foo"/></a>

what we have now

<a href="/page/index.html/#/foo"/></a>

What does the proposed API look like?

base: {
    url: '/page/index.html'
    trailingSlash: false
}
@posva
Copy link
Member

posva commented Aug 1, 2019

What is the use case for that?

@tychenjiajun
Copy link
Author

@posva Our backend only allow us to use index.html to be the only entry to the SPA.

@posva
Copy link
Member

posva commented Aug 1, 2019

Initial navigation should still work as the router will still recognize index.html#/users/:id. But, the base should be /page/ without the index.html, that way the server can probably also answer correctly

@tychenjiajun
Copy link
Author

@posva No, the server response 404 on /page/ and fail to answer the CSS and js files if request URL is /page/index.html/#/. I was told to only use /page/index.html to be the only entry.

<router-link> works well when clicked. For example, <router-link to="/foo"> can navigate us from /page/index.html#/ to /page/index.html#/foo, but its rendered href is <a href="/page/index.html/#/foo">, which makes us unable to right click it and open in a new tab.

And here is an example: https://codesandbox.io/s/vue-template-v7qmf

@posva
Copy link
Member

posva commented Aug 3, 2020

I forgot about this but with Hash mode, there should be no base specified. It's picked up automatically from the URL

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

2 participants