Closed natemoo-re closed 1 year ago
It would be quite neat if there was a way to specify setup code that only gets loaded on server side or client side (like with the game engine melonJS, it would be cool to render the game to a static image on the server side, render that on the initial page load, then on the client side replace it with the actual game after the page has mounted)
See Also: https://github.com/melonjs/melonJS/issues/1134 (to me this issue appears quite difficult to implement atm)
Update: After discussing this during [Community Call] October 4, 2022, we decided that it was too early to abstract this concept into a core Astro feature. As such, I have chosen to withdraw this RFC.
Thankfully, this can all be accomplished through our integration API (aka "in userland")! The plan is to implement this proposed behavior in the @astrojs/vue
integration. In the future, if we find ourselves repeating this pattern, we can revisit the idea of an abstraction built-in to astro
core.
It would be quite neat if there was a way to specify setup code that only gets loaded on server side or client side (like with the game engine melonJS, it would be cool to render the game to a static image on the server side, render that on the initial page load, then on the client side replace it with the actual game after the page has mounted)
See Also: melonjs/melonJS#1134 (to me this issue appears quite difficult to implement atm)
This should be possible now, even without a feature like this! Feel free to ping me on Discord and I can walk you through it.
Summary
This RFC proposes a unified interface that provides a hook into island setup. User-provided hooks will run for both server rendering and client-side hydration.
The primary motivation is unblocking
vue.use
, but there are other use cases as well.Links