-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use load
but only at build time
#1660
Comments
Thanks. I agree with what you're saying. We've talked about this before amongst the maintainers that we'd like to have different hydration modes with one to handle static content. I'm not sure there's really an open issue for this, but it is something we're thinking about in Svelte core. Probably the closest performance improvement to getting implemented is something along the lines of sveltejs/svelte#4308 |
We have several use cases for a build-time only |
A parallel feature would be enabling load functions solely on the server side, described in #1922 Glad to close the issue and concentrate the discussion here if applicable :) |
Was any progress made on this? I have so many cases where a built-time only load function would be really handy but not entirely sure how to get something like that running using adapter-static at this point in time. |
Here is an implementation that does allow some build-time using a config preprocess: [https://franknoirot.co/posts/svelte-build-time-data-preprocessing/]. As is, it works, but only if there are no other variables or imports in the script tag that handles loading the build-time data, e.g.
|
Our current thinking on this is that endpoints themselves should be prerenderable — in other words, as the prerenderer crawls your app, if it hits In that case, I'm going to close this in favour of #4093, which tracks prerenderable endpoints. |
Hi team I looked through the issue list and didn't see an already opened/closed issue that seemed relevant. Really enjoying the DX of svelte-kit so far!
I'm using the Vercel adapter and am looking to use the page
load
function to pull in static blog posts from markdown files at build time from a dynamic route. So far I've set the followingThis works okay, however this post is nested inside several layout files, where in the top-level layout file we're adding interactive features like a theme toggle, or a "now playing" section that pulls from Spotify. Now if I were to deep link to a post page the interactive features like the toggle do not work.
Is it possible to pull this purely static data into the page without removing the interactivity from parent layouts -- almost like a static fragment inside the interactive page? I'm considering moving back to the static adapter to help not expose endpoints, but curious to hear from the team.
The text was updated successfully, but these errors were encountered: