Skip to content

Transport & Reroute hooks are mandatory if hooks.(js|ts) exists #13508

Open
@WarningImHack3r

Description

@WarningImHack3r

Describe the bug

When the hooks.(js|ts) file exists and does not contain an exported transport function, the following Vite warning is emitted:

.svelte-kit/generated/client-optimized/app.js (21:28): "transport" is not exported by "src/hooks.ts", imported by ".svelte-kit/generated/client-optimized/app.js"

The exact same thing is true for the reroute function.

Reproduction

  1. create a SvelteKit app
  2. create an empty src/hooks.ts
  3. npm run build

Logs

System Info

(SvelteLab specs)

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.3.1 
    @sveltejs/kit: ^2.5.27 => 2.17.3 
    @sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.3 
    svelte: ^5 => 5.20.4 
    vite: ^6.0.0 => 6.2.0

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedPRs welcomed. The implementation details are unlikely to cause debate

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions