vite
vite copied to clipboard
fix: serve and preview with base
Description
close #8770
Additional context
What is the purpose of this pull request?
- [x] Bug fix
- [ ] New Feature
- [ ] Documentation update
- [ ] Other
Before submitting the PR, please make sure you do the following
- [x] Read the Contributing Guidelines.
- [x] Read the Pull Request Guidelines and follow the Commit Convention.
- [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
fixes #123). - [ ] Ideally, include relevant tests that fail without this PR but pass with it.
Deploy Preview for vite-docs-main ready!
| Name | Link |
|---|---|
| Latest commit | 5c2805a8f0e08f8f66ceb49e5ffb15555ddb5c10 |
| Latest deploy log | https://app.netlify.com/sites/vite-docs-main/deploys/62c1ccd301c1740008e9ca51 |
| Deploy Preview | https://deploy-preview-8772--vite-docs-main.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
This won't really work with SvelteKit. We have a trailingSlash option which indicates whether we expect URLs to have a trailing slash or not. This PR is currently assuming that there will always be a trailing slash, but for users who have chosen not to have one (which is the default in SvelteKit) it's not really correct.
Perhaps Vite should accept base with or without a trailing slash so that the user can decide which they would prefer or add a new trailingSlash option similar to SvelteKit's
@benmccann It didn’t work at all previously so would it break SvelteKit?
Of course I agree we should support base without slash.
SvelteKit historically hasn't used the publicDir and base options, but does its own static asset serving. I put together a branch to use Vite's implementation. I came across this PR while looking at what Vite's implementation does and wanted to make sure to mention it so that we don't bake in too many assumptions. I filed an issue regarding support without a slash: https://github.com/vitejs/vite/issues/9236
@sapphi-red Any progress on this?
No, I've put this in the team board but not discussed yet.