Wraps @lit-labs/ssr to render a single Lit TemplateResult (or a
pre-constructed <schema-view> Custom Element template) to an HTML
string with Declarative Shadow DOM markup.
Documented limitations
@lit-labs/ssr is currently published under the @lit-labs/*
scope: labs status, which the Lit project explicitly flags as
"not yet ready for general production use". The schema-components
SSR entry inherits these constraints:
Labs status. The API surface and output format may change in
breaking ways without a major version bump on lit proper.
Pin @lit-labs/ssr precisely if you depend on this entry in
production.
Async component work is not supported. Components that
initiate work in connectedCallback and resolve in
updateComplete will render at their pre-update state. The
built-in <sc-*> elements complete their first render
synchronously, so this constraint only bites for consumer-
supplied widgets.
Light-DOM-only components are not supported. A custom
element that overrides createRenderRoot() to return this
(rendering into the light DOM rather than a Shadow DOM) will
not server-render. All built-in <sc-*> elements use Shadow
DOM and so are compatible.
@lit/context does not server-render. Any value provided
via the context port from lit/contexts.ts is undefined on
the server. Consumers must default gracefully.
Declarative Shadow DOM support in the consumer's runtime is
required for hydration. Modern browsers support it; older
targets need the @webcomponents/template-shadowroot polyfill.
Server-side rendering entry for the Lit adapter.
Wraps
@lit-labs/ssrto render a single LitTemplateResult(or a pre-constructed<schema-view>Custom Element template) to an HTML string with Declarative Shadow DOM markup.Documented limitations
@lit-labs/ssris currently published under the@lit-labs/*scope: labs status, which the Lit project explicitly flags as "not yet ready for general production use". The schema-components SSR entry inherits these constraints:litproper. Pin@lit-labs/ssrprecisely if you depend on this entry in production.connectedCallbackand resolve inupdateCompletewill render at their pre-update state. The built-in<sc-*>elements complete their first render synchronously, so this constraint only bites for consumer- supplied widgets.createRenderRoot()to returnthis(rendering into the light DOM rather than a Shadow DOM) will not server-render. All built-in<sc-*>elements use Shadow DOM and so are compatible.@lit/contextdoes not server-render. Any value provided via the context port fromlit/contexts.tsisundefinedon the server. Consumers must default gracefully.@webcomponents/template-shadowrootpolyfill.Each limitation is documented at the Lit SSR project page: https://lit.dev/docs/ssr/overview/