sveltekit-blog-starter icon indicating copy to clipboard operation
sveltekit-blog-starter copied to clipboard

fix typos and add prerender.entries

Open JaKXz opened this issue 1 year ago • 6 comments

Continuing thoughts from #10, this PR:

  • updates all svelte dependencies [and nearly gets the build passing!]
  • fixes a typo in the /blog/category/page/[page] route
  • and adds all the routes that aren't explicitly pre-rendered to sveltekit's prerendering...
  • [and I apologize for vscode auto-formatting the files touched]

~~but... here's a new / more inscrutable error we're still seeing:~~ solved this error in my linked PR below by removing what look like errant routes and calls.

/Users/jasonkurian/src/github.com/josh-collinsworth/sveltekit-blog-starter/node_modules/undici/lib/fetch/body.js:271
        throw new TypeError('The body has already been consumed.')
              ^

TypeError: The body has already been consumed.
    at consumeBody (/Users/jasonkurian/src/github.com/josh-collinsworth/sveltekit-blog-starter/node_modules/undici/lib/fetch/body.js:271:15)
    at consumeBody.next (<anonymous>)
    at Response.arrayBuffer (/Users/jasonkurian/src/github.com/josh-collinsworth/sveltekit-blog-starter/node_modules/undici/lib/fetch/body.js:353:24)
    at visit (file:///Users/jasonkurian/src/github.com/josh-collinsworth/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:257:69)

JaKXz avatar Oct 17 '22 01:10 JaKXz

Deploy Preview for sveltekit-static-starter failed.

Name Link
Latest commit e233f72f93ee7d1f4611002938e0bebc53cbcf7a
Latest deploy log https://app.netlify.com/sites/sveltekit-static-starter/deploys/634cb1dd9d66df0008e5743e

netlify[bot] avatar Oct 17 '22 01:10 netlify[bot]

Here's the PR on my fork that got everything working, but, I'd love to double check that I didn't remove anything that's actually necessary: https://github.com/JaKXz/jakxz.github.io/pull/23

JaKXz avatar Oct 17 '22 02:10 JaKXz

I'd like to know a little more about the problem this PR is solving, if you're up for an explainer. I can see it converts some server files to page.server, and adds config.prerender routes, but I think I could use some help understanding what the core issue this all solves is. It seems like the current way it's working is doing all right, but I think I'm maybe not running into the same prerendering issues you might have been? I'd love to understand more.

josh-collinsworth avatar Oct 21 '22 03:10 josh-collinsworth

@josh-collinsworth are you seeing this build error on the latest main? Maybe your local working state is different than what's committed?

file:///Users/jasonkurian/src/github.com/josh-collinsworth/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:433
		throw new Error(
		      ^

Error: The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:
  - api/posts/category/[category],  - api/posts/page/[page],  - blog/category/page/[page],  - blog/category/[category]/page,  - blog/category/[category]/page/[page],  - blog/page/[page]

See https://kit.svelte.dev/docs/page-options#prerender-troubleshooting for info on how to solve this
    at prerender (file:///Users/jasonkurian/src/github.com/josh-collinsworth/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:433:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

JaKXz avatar Oct 21 '22 15:10 JaKXz

@JaKXz No, the build seems to be working fine for me as of last night, though I did do some other updates as well. Maybe I accidentally either fixed the issue a different way, or waited long enough that it resolved itself?

josh-collinsworth avatar Oct 21 '22 16:10 josh-collinsworth

🤔 I just did a fresh clone and npm i (and it still failed)... curious what's different...

JaKXz avatar Oct 21 '22 16:10 JaKXz

@JaKXz Ahhhh I think it finally bit me after updating SvelteKit again. I just pushed a new version that implements some of the fixes from your PR above. 🙌

josh-collinsworth avatar Oct 24 '22 20:10 josh-collinsworth

Awesome! I'll close this :)

JaKXz avatar Oct 24 '22 20:10 JaKXz