Closed didier closed 3 years ago
This is something that would need to be implemented Svelte rather than SvelteKit. It might happen one day but it will take a lot of detailed design work (in the form of RFCs) and as such this issue isn't something we can turn into a course of action, so I'll close it — thanks
Is your feature request related to a problem? Please describe. We already have an implementation of 'fully static' pages (no JS, SSR'd, etc.). One issue with this is that you can't always predict upfront if a page is going to be fully static or in need of enhancement.
Describe the solution you'd like One solution to this issue could be defining the
prerender
,ssr
router
and other meta stuff on a per-component basis. I'm not sure if this is at all doable. Possibly in the form of aexport const static = true
, or something along those lines. To give an example: Say I have aHeader
component, which includes a title and some navigation items. I would only need to render this once. It doesn't need to be reactive or dynamic in any way, after the first render. It would be nice if we could omit any JS being shipped for this specific component.Describe alternatives you've considered I'm not exactly sure on the inner workings of the current per-page implementation; my suggestion may not be the best approach to something like this. One other alternative would be to somehow detect with the compiler if a component is ever updated, and enable or disable JS based on that.
How important is this feature to you? Not a dealbreaker, but it would greatly improve Kit for semi-static sites, in my opinion.
Additional context This is largely inspired by something ElderJS offers, and the Islands Architecture as seen in Astro. I think Kit would also be a perfect contender for something like this, as it is the 'one true' official way to build with Svelte.