Skip to content

Setting BASE_PATH causes production build to always use trailing slashes #11483

@ayroblu

Description

@ayroblu

Describe the bug

When I build and preview using the following:

BASE_PATH="/test" bun run build && BASE_PATH="/test" bun run preview

I noticed that when I land, I start on http://localhost:4173/test but I'm always redirected to http://localhost:4173/test/. This seems like a vite thing and I can live with it (this is fine).

However for every child route, e.g. {base}/todo, it redirects to {base}/todo/. Also refreshes will change the route to /todo

Reproduction

https://github.com/ayroblu/svelte-kit-11483

Logs

No response

System Info

  System:
    OS: macOS 14.1.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 68.53 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.3.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.19.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 120.0.6099.129
    Edge: 113.0.1774.42
    Safari: 17.1.2
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.0.1 
    @sveltejs/kit: ^2.0.0 => 2.0.6 
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.1 
    svelte: ^4.2.7 => 4.2.8 
    vite: ^5.0.3 => 5.0.10 

Severity

blocking all usage of SvelteKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions