Skip to content

Commit

Permalink
feature/issue 1197 Lit v3 upgrade and SSR fixes and enhancements (#1201)
Browse files Browse the repository at this point in the history
* initial upgrade for test cases

* upgrade CLI and www to Lit v3

* revert static router test case change

* all tests passing

* patch escodegen for better ESM support

* test for lit element hydration script

* refactor rollup config

* update Lit renderer README and apply conditional Lit script hydration

* comments and TODOs cleanup

* minor rebase patches

* WCC v0.12.0 upgrade and removing patches directory

* hydration default documentation and testing for Lit renderer plugin
  • Loading branch information
thescientist13 committed Jun 2, 2024
1 parent d8b49b0 commit 982f8b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 0 additions & 5 deletions packages/cli/src/lifecycles/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,9 @@ const generateGraph = async (compilation) => {
* template: page template to use as a base for a generated component
* title: a default value that can be used for <title></title>
* isSSR: if this is a server side route
<<<<<<< HEAD
* prerender: if this should be statically exported
* isolation: if this should be run in isolated mode
* hydration: if this page needs hydration support
=======
* prerednder: if this should be statically exported
* isolation: if this should be run in isolated mode
>>>>>>> 55f36b76 (feature/discussion 1117 Isolation Mode (v1) (#1206))
*/
pages.push({
data: customData || {},
Expand Down
12 changes: 11 additions & 1 deletion packages/plugin-renderer-lit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ yarn add @greenwood/plugin-renderer-lit --dev
1. Please familiarize yourself with some of the [caveats](https://lit.dev/docs/ssr/overview/#library-status) called out in the Lit docs, like:
- Lit SSR [**only** renders into declarative shadow roots](https://github.com/lit/lit/issues/3080#issuecomment-1165158794), so you will have to keep browser support and polyfill usage in mind.
- At this time, `LitElement` does not support `async` work. You can follow along with this issue [in the Lit repo](https://github.com/lit/lit/issues/2469).
1. Lit only supports templates on the server side for HTML generated content, thus Greenwood's `getBody` API must be used. We would love for [server only components](https://github.com/lit/lit/issues/2469#issuecomment-1759583861) to be a thing though!
1. Lit only supports templates on the server side for HTML only generated content, thus Greenwood's `getBody` API must be used. We would love for [server only components](https://github.com/lit/lit/issues/2469#issuecomment-1759583861) to be a thing though!
1. Lit does not support [`CSSStyleSheet` (aka CSS Modules) in their SSR DOM shim](https://github.com/lit/lit/issues/2631#issuecomment-1065400805).
1. Full hydration support is not available yet. See [this Greenwood issue](https://github.com/ProjectEvergreen/greenwood/issues/880) to follow along with when it will land.

Expand Down Expand Up @@ -87,6 +87,16 @@ export async function getBody() {
}
```

<<<<<<< HEAD
=======
## Caveats

There are a few considerations to take into account when using a `LitElement` as your page component:
- Lit SSR [**only** renders into declarative shadow roots](https://github.com/lit/lit/issues/3080#issuecomment-1165158794), so you will have to keep browser support and polyfill usage in mind.
- Depending on your use case, SSR bundling may break due to bundle chunking and code splitting by Rollup, which we are [hoping to correct ASAP](https://github.com/ProjectEvergreen/greenwood/issues/1118).
- At this time, `LitElement` does [not support `async` work](https://lit.dev/docs/ssr/overview/#library-status) which makes data fetching in pages a bit of challenge. You can follow along with this issue [in the Lit repo](https://github.com/lit/lit/issues/2469).

>>>>>>> 82460ea4 (feature/issue 1197 Lit v3 upgrade and SSR fixes and enhancements (#1201))
## Options

### Isolation Mode
Expand Down

0 comments on commit 982f8b0

Please sign in to comment.