diff --git a/.changeset/sour-pigs-talk.md b/.changeset/sour-pigs-talk.md new file mode 100644 index 000000000000..5498ed229873 --- /dev/null +++ b/.changeset/sour-pigs-talk.md @@ -0,0 +1,5 @@ +--- +"@sveltejs/kit": patch +--- + +fix: export `init` hook from `get_hooks` diff --git a/packages/kit/src/core/sync/write_server.js b/packages/kit/src/core/sync/write_server.js index f4568743728e..5dabea1f1c44 100644 --- a/packages/kit/src/core/sync/write_server.js +++ b/packages/kit/src/core/sync/write_server.js @@ -67,7 +67,8 @@ export async function get_hooks() { let handle; let handleFetch; let handleError; - ${server_hooks ? `({ handle, handleFetch, handleError } = await import(${s(server_hooks)}));` : ''} + let init; + ${server_hooks ? `({ handle, handleFetch, handleError, init } = await import(${s(server_hooks)}));` : ''} let reroute; ${universal_hooks ? `({ reroute } = await import(${s(universal_hooks)}));` : ''} @@ -77,6 +78,7 @@ export async function get_hooks() { handleFetch, handleError, reroute, + init, }; }