I just finished create a new package called
npdev:svelte-loadable! This is based on a base of an excellent package which already existed called
svelte-loadable, and retains much of that packages API, but adds an easier to optimize way to register loadables, and SSR/hydration support. If you are new to loadables (
svelte-loadable), the package works a lot like
npdev:react-loadable, and can be used to split code by components.
There are a few things left to complete:
Documentation! There is none.
- Tests - there are none!
- There are a few configuration error scenarios which will likely fail in ugly ways right now - needs better guardrails. Part of that is rearranging some of how the loading works (it’s noted with a TODO).
- A babel plugin!
npdev:react-loadableeach have babel plugin to reduce the amount of configuration boilerplate which much be entered to make SSR and hydration work. (Update: I have a babel plugin, but it doesn’t get applied to the code compiled by svelte - not sure how to fix that)
(One thing left to complete in my starter is some data hydration solution. I don’t have anything for that, so the content on the “About” page will flash of loading after the page loads - but you can see in the source that the loadable SRR support is working. You can see that hydration support is working on the homepage, which is flash free).