Skip to content

Request: an adapter between static and nodejs #1652

@kainsavage

Description

@kainsavage

Describe the solution you'd like
I have been playing with the static adapter and find it great for simple sites (like my blog), but I think there is a need for an adapter that provides complete client-side (read: no SSR at all) SvelteKit applications while supporting actual Svelte functionality. For example, the documentation says:

In other words, any app that involves user sessions or authentication is not a candidate for adapter-static, even if individual pages within and app are suitable for prerendering.

I think that this is because adapter-static is essentially running in SSR during dev, and builds the static html/css/js at build time. What would be great is if that same process were taken in a new adapter, but instead of treating SSR as the builder for static html/css/js, it would build an empty-bodied index.html which includes the Svelte bundle so that each route is its own contained Svelte application. This would essentially take the SvelteKit approach of routes and pages, but also support pages rendering differently based on authentication, for example.

Svelte application bundles appear to be pretty small after processing - the basic Svelte application has a 3kb bundle, and a fully built client SPA I am working on has ~4MB bundle size (which, I assume would be broken out into several smaller bundles on a per-page basis given the implementation I am suggesting). Additionally, all the niceties that adapter-static gives would still hold true since the adapter would be building individual pages and not an SPA (analytics, seo, etc).

How important is this feature to you?
I really like the idea behind SvelteKit, but have wanted to avoid both SPA and SSR given my experience with both. I would really like the client-side application to sit on its own and reap all the awesome features that Svelte has to offer. That said, I think this solution (or one with similar goals) is very important to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions