Base URL with custom protocol is prefixed with slash
See original GitHub issueDescribe the bug
After setting custom protocol, built dist files have a leading slash in path.
export default defineConfig({
base: 'app://',
});
(my use-case for custom protocol is to load app in Electron).
Reproduction
https://stackblitz.com/edit/vitejs-vite-bu8uph?file=dist/index.html
System Info
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Forward slashes in http protocol declaration in URL
I tried entering URLs in to many browsers without the forward slashes and they all work e.g. http:www.web-dewd.com works in Chrome, Firefox, ...
Read more >In a URL, what is // for? [closed] - Super User
The first slash separates the host name from the path. The last slash is the path. A web server can, if it wants...
Read more >Jekyll's site.url and baseurl - Made Mistakes
Double forward slashes e.g., //minima/assets/style.css; Missing base URL due to not using relative_url filter, absolute_url filter, or {{ site.
Read more >URL Pattern API - MDN Web Docs
In patterns that match against the pathname part of a URL, groups get an automatic slash ( / ) prefix added if the...
Read more >Configure Hosting behavior | Firebase Hosting - Google
Serve a function or access a Cloud Run container from a Hosting URL. ... Specify custom domain path prefixes to use for Dynamic...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we should close this though, I prefer we get a real use case to justify changing the
isExternal
logic. Let’s wait til then.Turns out, I don’t need to change the base path at all. Really feel stupid for not trying this from the beginning (considering it’s the default setting). 😄 Using
app://
was a workaround for something in Chromium or Electron or VueCLI and now (2 years later) is no longer needed.So yeah, although I no longer affected by this, it’s still a bug.