Is it - or will it - be possible to have multiple versions of Lit in the same application? #3646
-
👋 I'm part of a team that's building a design system with Lit. Our components are verisioned separately, so we don't have one single version for the entire design system.
This is my first interaction with OSS; so have I missed something please just ask! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, you can multiple versions of Lit, and with Lit 2 (lit-html 2.x and lit-element 3.x) onward, we even have very good compatibility across versions - you can use a template from one version in a render method of another. Lit is just a library, so it uses no globals. And each component is its own independent render root, so there's no central coordinator. Essentially each component brings along the version of Lit it needs and the module cache takes care of deduplication. If you're upgrading from LitElement 2 / lit-html 1, then there can be some issues where the templates from one version will not render in the other. Components are still independent though, so if you upgrade a component at a time, you should be ok. The difficulty with be with subclassing and utility templates. A subclass will need to update its Lit dependency with its base class. |
Beta Was this translation helpful? Give feedback.
Yes, you can multiple versions of Lit, and with Lit 2 (lit-html 2.x and lit-element 3.x) onward, we even have very good compatibility across versions - you can use a template from one version in a render method of another.
Lit is just a library, so it uses no globals. And each component is its own independent render root, so there's no central coordinator. Essentially each component brings along the version of Lit it needs and the module cache takes care of deduplication.
If you're upgrading from LitElement 2 / lit-html 1, then there can be some issues where the templates from one version will not render in the other. Components are still independent though, so if you upgrade a component …