Skip to content

handle hook runs in hooks.js #12065

@theetrain

Description

@theetrain

Describe the bug

From the docs, it's a bit unclear if the handle hook should be able to be exported from src/hooks.js, or if it's exclusively available in src/hooks.server.js.

In my reproduction, I noticed hooks.js@handle gets called only on server requests, as it should; but if I also define a hooks.server.js@handle then that one won't get called.

Reproduction

https://www.sveltelab.dev/k74t4p2om1m1dpt?files=.%2Fsrc%2Fhooks.js%2C.%2Fsrc%2Fhooks.server.js

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.2.0 
    @sveltejs/kit: ^2.0.0 => 2.5.5 
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.2 
    svelte: ^4.0.5 => 4.2.12 
    vite: ^5.0.0 => 5.2.7

Severity

annoyance

Additional Information

Possibly related to #4544.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions