vite icon indicating copy to clipboard operation
vite copied to clipboard

fix: serve and preview with base

Open JounQin opened this issue 3 years ago • 4 comments

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.

JounQin avatar Jun 24 '22 18:06 JounQin

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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Jun 24 '22 18:06 netlify[bot]

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 avatar Jul 19 '22 22:07 benmccann

@benmccann It didn’t work at all previously so would it break SvelteKit?

Of course I agree we should support base without slash.

JounQin avatar Jul 19 '22 22:07 JounQin

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

benmccann avatar Jul 19 '22 22:07 benmccann

@sapphi-red Any progress on this?

JounQin avatar Aug 03 '22 23:08 JounQin

No, I've put this in the team board but not discussed yet.

sapphi-red avatar Aug 04 '22 07:08 sapphi-red