-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@storybook/web-components lit v1 compat requires lit-html dependency #15275
Comments
@43081j what's the backwards-compatible fix? we'll probably drop v1 support in SB 7.0, but in the meantime what to do? make it an optional peer dependency? |
im really not sure, its a super awkward situation. i think we should have set them both as optional peer dependencies (lit-html 1.x, lit 2.x). im not sure how npm would handle the resolution, but maybe then if you had lit 2 as a peer, it'd resolve the if thats not how npm would deal with it, we'd be a bit stuck i think i'd hope, us having lit 2 would result in:
but no clue if thats how npm would do it that'd mean we could still import from |
It doesn't look like its optional so as it is right now it needs to stay required https://github.com/storybookjs/storybook/pull/14898/files#diff-6c3ee5d62a4cb906cba13eff0e50822ea7b155558e7df3a1d98cdf3403a51a00R3
You can't rely on that, see https://yarnpkg.com/advanced/rulebook#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies for more details |
yeah which is why this is such an awkward position. i suppose the "right thing" to do would've been to not support lit2 in 6.x, and not support lit1 in 7.x. as far as i can tell, the issue is that consumers will install im not sure there's any good solution to that, though. anything we do to support both at once will result in trouble/hackery i think |
Do you think we should drop support for lit1 in storybook 7.0 beta? And thus only support lit2? |
Whether to support lit 1 or 2 may need to be a different issue, I think. As I read it, this issue is about resolving the transitive dep discrepancies. |
Removing [email protected] support in v7 will solve this and is a good idea. Too bad CSF@3 went out without a renderer method that would allow for pluggable renderers, which would have prevented the need for SB to manage dependencies like this. |
@Westbrook I can open a PR changing the peerDep restriction, easy, but perhaps it's something you'd like to do? |
there's still a fair amount of projects around using lit 1.x with storybook im sure (think we have a few somewhere even). however i agree w/ westbrook it'd be sensible to remove support for it and just keep those users on 6.x of storybook. |
Describe the bug
Introduced by #14898.
The peer dependency configuration means that we're forced to have
lit-html
as a dependency to make storybook pull in the right peer.We have something like this inside storybook now:
however, going forward the best practice is to pull from
lit
, notlit-html
. Which means all lit v2 projects will have to install lit-html as a dependency to force storybook into resolving the right one.Not having the right version means we then have the wrong
TemplateResult
in the types, causing build errors in typescript projects.you can see this also mentioned here:
#14898 (comment)
I also understand we're making
@storybook/lit
but web-components should still work correctly, without having to add an unnecessary dependency.The text was updated successfully, but these errors were encountered: