Closed einaralex closed 4 months ago
I just realized this might not be a problem with npm and pnpm; I think they install peer dependencies from other package dependencies. We use Yarn.
I created a PR if you're interested.
@einaralex Thanks for the kind words, and for raising this!
I'm honestly not 100% clear on how peerDependencies are supposed to work, despite having read the docs a dozen times.
Here's what I'm trying to achieve, maybe you can help me figure this out?
ethers
(a regular dependency) contains @noble/hashes
as a dependency. (Also incidentally, viem
(if you have it installedalso contains
@noble/hashes` as a dependency, and basically every other provider library)@noble/hashes
you already have, either installed directly or indirectly, without accidentally installing yet another version as a parallel dependency.Any idea what the best way to do this in a way that is yarn-compatible? My understanding is that yarn v2+ has peerDependencies support?
Yeah haha, I noticed I have 6 different versions of noble/hashes in my yarn.lock from different web3 packages. I don't think there is a good automated way to do it. Since you list ethers as a dependency, I'd probably just follow that version, since the user of your app will get that version of ethers, you'd be matching that.
I just noticed we are actually using v1 of Yarn, so it's maybe more of a me-problem :P
Would you be up for trying Yarn v2+ and seeing if it solves this for you?
I'd like to keep the whatsabi bundle as small as possible, and adding more direct dependencies can make things tricky for tree-shaking. :)
Closing for now, let me know if you think it's still an issue with whatsabi.
I just wanted to start by thanking you for this fantastic package; I've been struggling to identify ERC-1271 proxies and finally found an efficient way to do it with your package.
Listing @noble/hashes as a peerDependency in your package requires your users to install it as a dependency in their application. Ethers, Safe and other packages do this.