Skip to content

Commit

Permalink
move user_hooks init back from whence it came
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Aug 24, 2022
1 parent e9286ad commit 5b9b0db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/kit/src/vite/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@ export async function dev(vite, vite_config, svelte_config, illegal_imports) {
set_private_env(env.private);
set_public_env(env.public);

/** @type {Partial<import('types').Hooks>} */
const user_hooks = resolve_entry(svelte_config.kit.files.hooks)
? await vite.ssrLoadModule(`/${svelte_config.kit.files.hooks}`)
: {};

return () => {
const serve_static_middleware = vite.middlewares.stack.find(
(middleware) =>
Expand Down Expand Up @@ -323,6 +318,11 @@ export async function dev(vite, vite_config, svelte_config, illegal_imports) {
);
}

/** @type {Partial<import('types').Hooks>} */
const user_hooks = resolve_entry(svelte_config.kit.files.hooks)
? await vite.ssrLoadModule(`/${svelte_config.kit.files.hooks}`)
: {};

const handle = user_hooks.handle || (({ event, resolve }) => resolve(event));

/** @type {import('types').Hooks} */
Expand Down

0 comments on commit 5b9b0db

Please sign in to comment.