Skip to content

Commit

Permalink
fix: provide better error message in case of missing +page.svelte (#…
Browse files Browse the repository at this point in the history
…8478)

* fix: provide better error message in case of missing `+page.svelte`

closes #8270

* Update packages/kit/src/runtime/server/page/render.js

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* oops

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
  • Loading branch information
3 people authored Jan 13, 2023
1 parent 51c1cad commit f09ad43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-badgers-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: provide better error message in case of missing `+page.svelte`
5 changes: 5 additions & 0 deletions packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export async function render_response({
: null;

if (page_config.ssr) {
if (!branch.at(-1)?.node.component) {
// Can only be the leaf, layouts have a fallback component generated
throw new Error(`Missing +page.svelte component for route ${event.route.id}`);
}

/** @type {Record<string, any>} */
const props = {
stores: {
Expand Down

0 comments on commit f09ad43

Please sign in to comment.