Description
I've had problems with loading components asyncronously using dynamic import and SSR on JAM-stack site. Consider a situation where locally stored JSON data dictates what component to load at build-time.
The workaround I've been using thus-far is loading all the components on build-time on module context and only needed components on client-side using render-blocking if-block. But that is ugly and might cause a race condition (although only on rare cases) since the component loading on build-time isn't awaited.
What I would like to have is way to block build-time rendering (SSR) for the time of loading dynamically imported components.
I tried to implement some kind of beforeMount lifetime hook, but it doesn't seem possible with the compiled code and template being tied together. Then I tried implementing top-level await for the script block but Acorn JavaScript parser started complaining just by thought of that.
Potential feature that could solve it could be svelte:dependency tag. It could function as an await after script execution and before template rendering.
<svelte:dependency await={promise} />