Skip to content

Ability to serve base page without trailing slash #9236

@benmccann

Description

@benmccann

Description

SvelteKit has a trailingSlash option which indicates whether we expect URLs to have a trailing slash or not. By default all URLs do not have a trailing slash. However, Vite forces a trailing slash on the base URL.

Implementing this would close #8770 and #8772

Suggested solution

Vite could accept base with or without a trailing slash so that the user can decide which they would prefer. However, this would be a breaking change as anything reading base from the config would now have to handle the possibility both of it having or not having a trailing slash

Alternative

Add a new trailingSlash option similar to SvelteKit's. I think it would likely only affect the base URL though for Vite

#8772 is open which affects this functionality as well, but would not work as a solution for SvelteKit as it always forces a trailing slash and would conflict with SvelteKit's trailingSlash option

Additional context

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, but some of our tests are failing with it due to this issue, which is a blocker for us.

https://github.com/sveltejs/kit/pull/5601/files#r923967104

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp3-downstream-blockerBlocking the downstream ecosystem to work properly (priority)

    Type

    No type

    Projects

    Status

    Discussing

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions