[SSR] accept a string for module contents when calling renderModule
("in memory" VM modules)
#2086
thescientist13
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Thanks for the feedback. The SSR API is indeed very raw right now, and we do intend to involve it to meet the use cases users bring up like this! We've been working hard to harden the core Lit 2 release, but once we get that out we'll start working more on refining the SSR API and testing it against user needs. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview
Not sure if this is feasible or just an over optimization, as I have just started playing around with the SSR package, but had a question / suggestion in regards to using VM modules and the
renderModule
function but was curious if there were other options for providing the "render" module other than as a file on disk? Say if you are generating a bunch of pages (like for a SSG) it could be cleaner and less steps if everything could be done "in memory".Current Behavior
For example, from the docs, to render in a VM module, a file must be provided
In the context of the the demo example, this seems reasonable if your app only has one template / layout. But it is common for (content heavy) apps and sites to have many layouts, for many types of pages. And with the need to be able to build pages on the fly for things like ISG or DPR, following this approach it would stand to reason that you would need a render-module.js type file for every possible page layout in your site.
A couple ways around this I could see, but feel a little clunky are:
if / else
orswitch
logic to choose the correspondingrender
module file for that given page / request.renderModule
(and presumably clean up these files following some sort of system?)Both of these would have to maintained and kept up with over time, as templates come and go within the site.
Proposal
If there was the ability to just pass contents of render_module.js to
renderModule
function, then we could save a couple steps and perhaps be a little more ergonomic for these kinds of use cases, and probably tap into some optimizations / efficiencies too? 🙏Something like this, where we
renderModule
instead of a file pathBeta Was this translation helpful? Give feedback.
All reactions