Skip to content

Feature Request for Svelte 5 support #307

@GELight

Description

@GELight

Environment:

I have installed your router (I already used it in my old Svelte 3 and Svelte 4 projects) in my new Svelte 5 environment.

  System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (32) x64 AMD Ryzen 9 7950X3D 16-Core Processor
    Memory: 14.18 GB / 30.48 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 22.7.0 - ~/.nvm/versions/node/v22.7.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.7.0/bin/npm
  Browsers:
    Brave Browser: 128.1.69.168
    Chrome: 128.0.6613.137
  npmPackages:
    svelte: 5.0.0-next.246 => 5.0.0-next.246

Problem:

Visually the router is running, but my console log shows errors on mount and on every router navigation.

The error looks like this:

image

This is my using:

<Router url="/">
    <nav>
        <cow-ps-button
            onclick="{() => navigateTo('/')}"
            onkeydown="{(event: KeyboardEvent) => { if (event.key === 'Enter' || event.key === ' ') navigateTo('/'); }}"
            role="button" tabindex="0">Home
        </cow-ps-button>
        <cow-ps-button
            onclick="{() => navigateTo('/button')}"
            onkeydown="{(event: KeyboardEvent) => { if (event.key === 'Enter' || event.key === ' ') navigateTo('/button'); }}"
            role="button" tabindex="0">Home
        </cow-ps-button>
    </nav>
    <div class="showcase-page">
        <Route component={Home} path="/" />
        <Route component={Button} path="/button" />
    </div>
</Router>

Note:

The cow-ps-button component is a custom element which is imported in my index.html
(not inside my Svelte component where I use the router).

No errors occurred in older versions of Svelte.

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