You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since updating SvelteKit this does not work anymore and I get an internal server error. I provided the stack trace.
After tinkering around I found that if you create an empty universal hook file and add it to svelte.config.js like this:
Error: Failed to load url /src/hooks (resolved id: /src/hooks). Does the file exist?
at loadAndTransform (file:///<project_path>/node_modules/vite/dist/node/chunks/dep-yUJfKD1i.js:40842:17) {
code: 'ERR_LOAD_URL',
runnerError: Error: RunnerError
at reviveInvokeError (file:///<project_path>/node_modules/vite/dist/node/module-runner.js:545:18)
at Object.invoke (file:///<project_path>/node_modules/vite/dist/node/module-runner.js:628:15)
at async SSRCompatModuleRunner.getModuleInformation (file:///<project_path>/node_modules/vite/dist/node/module-runner.js:1200:73)
at async request (file:///<project_path>/node_modules/vite/dist/node/module-runner.js:1222:88)
at async get_hooks (<project_path>/.svelte-kit/generated/server/internal.js:44:28)
at async eval (<project_path>/node_modules/@sveltejs/kit/src/runtime/server/index.js:82:20)
at async Server.init (<project_path>/node_modules/@sveltejs/kit/src/runtime/server/index.js:80:3)
at async file:///<project_path>/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:489:5
Describe the bug
I have defined an alternative path for my server hook file in svelte.config.js, which is
[....]
files: { hooks: { server: 'src/hooks/hooks.server' } }
[....]
Since updating SvelteKit this does not work anymore and I get an internal server error. I provided the stack trace.
After tinkering around I found that if you create an empty universal hook file and add it to svelte.config.js like this:
files: { hooks: { server: 'src/hooks/hooks.server', universal: 'src/hooks/hooks' } }
Then it works.
Strangely adding a client hooks file does not work, only with a universal hooks file.
Did something change recently that I missed? I could not find anything related to this.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-llqwvuwy
Logs
System Info
Severity
annoyance
Additional Information
UPDATE: Can confirm that the issue occurs from version 2.11.0 upwards.
No response
The text was updated successfully, but these errors were encountered: