josh-collinsworth / sveltekit-blog-starter

A preconfigured SvelteKit static blog starter, with Sass, Markdown, MDSvex, Rehype, background preloading, and more. See the README for full details.
https://sveltekit-static-starter.netlify.app/
MIT License
419 stars 81 forks source link

adapter-auto to help with pre-rendering #19

Closed jt196 closed 2 years ago

jt196 commented 2 years ago

Fairly new to the the world of Sveltekit but came up against this a few times today deploying on Vercel.

I don't know how this fits in with your setup, but I found the new adapter-auto did the job fixing my prerendering issues. Maybe it'll work with the static one as well deployed sites?

In svelte.config.js

import adapter from '@sveltejs/adapter-auto';

and adding "@sveltejs/adapter-auto": "next", to package.json.

josh-collinsworth commented 2 years ago

Thanks for your comment. I specifically chose adapter-static for this project, as the blog is meant to be statically prerendered.

As far as I know, adapter-auto will set up any route that's not explicitly marked for prerendering as a dynamic server-rendered route, running on Node. That may be desirable for some, to be sure, but it also may be unexpected, and in a worst-case scenario, could cause somebody to use up a lot of bandwidth and/or get hit with a bill from their host that they weren't expecting.

That's why I'd like to keep this project statically rendered; to make sure it's just simple assets on a CDN when deployed. (That said, however, if somebody wants to take this project and change any part of it to be dynamic, the way above would be a good way to do it.)

If folks want to modify the project, by all means. But I think static is the ideal default for what it is.