-
Notifications
You must be signed in to change notification settings - Fork 319
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
duplicate lit-html - possibly needs peerDependency
or reexport everything?
#682
Comments
Isn't the answer here to use |
Yeah... I think this can be an issue in many setups. Another example is loading from unpkg if there is a version mismatch. |
we want to pin the version of not ideal... we know... still pinning a version should not break everything right? imho if everything is exported from |
I believe pinning everything will work. Just need to point out that this is needed for all systems (npm, unpkg, pkgdrop*). * pkgdrop - my project for installing ESM |
Ideally, everyone would have a config where they get only one version of |
As noted, the problem here is pinning to a specific version of lit-html. If you do this, you increase the chance of duplication. Now, a reasonable package manager would have just chosen I did think that if you put the pinned dependency first in your dependency list that npm would install that first, and that will more likely meet the constraint of following transitive dependencies on the package. You seem to be doing that with the order of install commands, so I'm not sure why there's duplication with lit-element/lit-html dependency. @daKmoR is there a reason why you need to pin to a specific version? It pretty much breaks semver if you do that as a matter of course, because every release becomes a breaking change to you. |
@justinfagnani The issue, I believe, is that lit-element has a loose dep on I'm guessing either: A) Users importing lit-element need to always match the lit-html dep range inside lit-element's package.json. This would also apply to any libraries that use lit-element. |
I guess one more option (as @daKmoR methoned) is moving lit-html to a peerDependency. Thinking more about it... isn't that what peer dependencys are for? |
lit-html is a true dependency of lit-element |
I don't know a formal definition of a peer... my feeling is that a peer should be used when you publish a lib that uses a dependency that is also used by the consuming project. But that's just my take. As for now the only thing we, consumers of lit-element, can do is ensure we always use the same lit-html version range as the latest version of lit-element. |
That definition would include tons of common dependencies like lodash, rxjs. Peer dependencies create a burden for transitive dependents, and if one package truly depends on another it should just do so. You don't have to use exactly the same version range as lit-element, but you should use the widest range that you can: the lowest lower bound and highest upper bound. The means for lit-html you should be at |
Agreed, maybe too broad. But, in-fact, rxjs is a peer of angular. |
We're going to keep lit-html as a regular dependency (changing that would be a breaking change) and continue to try to solve these problems in tooling. |
Steps to Reproduce
Expected Results
one version of lit-html
Actual Results
$ yarn list --pattern lit-html yarn list v1.13.0 ├─ lit-element@2.1.0 │ └─ lit-html@1.1.0 └─ lit-html@1.0.0 Done in 1.10s.
Suggestion
I see 2 possible solutions...
lit-element
addslit-html
only as peer dependencylit-html
has get's exported so we can have only one dependency onlit-element
Note: right now we add
lit-html
as a dependency as we use features from it which are not reexported fromlit-element
(like directives).Versions
The text was updated successfully, but these errors were encountered: