DEV Community

Discussion on: How to handle peer dependencies when developing modules

Collapse
 
dspacejs profile image
Daniel Spajic

Is there a way to get this to work with other peer dependencies? It works great when it's just react, but I have several peer dependencies (such as react-redux) which is causing conflicts. I've been messing around with this a lot and I'm having trouble getting it to work.

Collapse
 
yvonnickfrin profile image
🦁 Yvonnick FRIN

You tried to do the same trick described in the article for react (linked module dependency directly into your host app) ? I agree this is a bit messy. You can use yarn v2 to fix this problem (I guess). See Maël Nison's comment on this article. He explains how it works in yarn v2 and where you can install this new version 👍

Collapse
 
dspacejs profile image
Daniel Spajic

Oh that's a better solution, thanks. I'd use that but my team uses NPM. I ended up just installing the peer dependencies for our library into peer_deps/node_modules so it's not picked up by the app but can still be used by the library during development.