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
If you have a hooks.server.ts or hooks.ts and you create a folder with the same name (hooks.server or more commonly hooks) the respective file will be "ignored" during the server generation.
we call resolve_entry with config.kit.files.hooks.server and config.kit.files.hooks.universal which by default are src/hooks.server and src/hooks. However inside resolve_entry we check if it's a directory and if it's a directory we resolve index on that directory
Describe the bug
If you have a
hooks.server.ts
orhooks.ts
and you create a folder with the same name (hooks.server
or more commonlyhooks
) the respective file will be "ignored" during the server generation.This is because here
kit/packages/kit/src/core/sync/write_server.js
Lines 85 to 119 in 78404df
we call
resolve_entry
withconfig.kit.files.hooks.server
andconfig.kit.files.hooks.universal
which by default aresrc/hooks.server
andsrc/hooks
. However insideresolve_entry
we check if it's a directory and if it's a directory we resolve index on that directorykit/packages/kit/src/utils/filesystem.js
Lines 169 to 191 in 78404df
What we should do is probably check also for the file and if there's a file AND a directory give precedence to the file.
Reproduction
hooks.server.ts
handle function is logging to the terminalhooks
folderreroute
function is logging to the consolehooks.server
(you need to refresh the page for it to take fully effect...bug in sveltelab sorry 😅)Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
This can be very hard to debug.
The text was updated successfully, but these errors were encountered: