Skip to content

basepath in Router not working for Link #305

@lucatmedmij

Description

@lucatmedmij

Custom basepath works for Route but it does not work for Link

This works

  <Router basepath="/web">
    <Route component={Home} path="/" />
    <Route component={About} path="/about"  />
  </Router>

This does not work, it gives link without basepath

  <Router basepath="/web">
      <Link to="/">Home</Link>
      <Link to="/about">About</Link>
  </Router>

I use svelte 4 with vite

package.json

{
  "name": "test",
  "private": true,
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build --base=./",
    "preview": "vite preview",
    "check": "svelte-check --tsconfig ./tsconfig.json && tsc -p tsconfig.node.json"
  },
  "devDependencies": {
    "@sveltejs/vite-plugin-svelte": "^3.1.1",
    "@tsconfig/svelte": "^5.0.4",
    "eslint": "^9.9.1",
    "svelte": "^4.2.18",
    "svelte-check": "^3.8.5",
    "tslib": "^2.6.3",
    "typescript": "^5.5.3",
    "vite": "^5.4.0"
  },
  "dependencies": {
    "svelte-routing": "^2.13.0"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions