question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move react as peerDependency

See original GitHub issue

First of all great work on this package.

I have come across an issue of multiple react installations. This was not a problem during development and bundling for production but more in testing. The tests just fail when run in combination with Create React App with an error saying that there may be more than once installations of react. I did npm ls react at root level and found that is the case:

components@1.0.0 components
├─┬ media-gallery@1.0.1 -> components/src/packages/media-gallery
│ └─┬ react-image-gallery@0.8.18
│   └── react@16.9.0
└── react@16.9.0

I think moving react to be as a peerDependency would resolve this or similar problems. This obviously be a breaking change so would require a major release in case it goes ahead.

Let me know what you think. Cheers

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
xiaolincommented, Aug 17, 2019

released in v0.9.0

0reactions
xiaolincommented, Aug 16, 2019

@jabranr Thanks, I reviewed your pr and the changes shouldn’t be breaking. If you can tweak the pr I can merge.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Move React and React DOM to peer dependencies #2052
Describe the problem Because react and react-dom packages are added as direct dependencies with compatible versions, adding this project in ...
Read more >
Understanding Peer Dependencies in JavaScript
In this case, you would declare React as a peer dependency for your components, because you want the host project to have the...
Read more >
What is the correct way of adding a dependency to react in ...
For reusable components: Put a react dependency in both peerDependencies and devDependencies . Never put a react dependency in dependencies ...
Read more >
A tip on using peer dependencies with TypeScript
React is now a peer dependency, which means the main application needs to list it in its own dependencies. Additionally, we're able to...
Read more >
Dependency Management | React Native Developer Tools
It then got moved out to the React Native Community organization as ... will suggest that we change peerDependencies and devDependencies to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found