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.

Could react be a peer dependency rather than a dependency?

See original GitHub issue

At the moment molstar has a dependency of "react": "^17.0.1", which means that it can only be used in react apps that use react 17.x.x - you cannot have different versions of react in the same react app, and installing molstar will install a second version of react if the existing react doesn’t match ^17.0.1.

Could react be made a peer dependency instead? This is the preferred way to specify that a plugin requires react. I’m happy to make a pull request to this effect, I just wanted to make sure it wouldn’t break anything or that I hadn’t misunderstood something about how react was being used.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
dsehnalcommented, Dec 14, 2021

3.0.0-dev.4 and newer now have React as peer dep.

0reactions
russellp17commented, Feb 21, 2022

So it looks like 16.14.0 has support for react-jsx but not earlier React 16.* versions: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform

Just put up a PR to permit React 16 as a peer dependency

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Peer Dependencies in JavaScript
Peer dependencies are almost like normal dependencies, but instead of defining a strong requirement between A and B (i.e the project you're ...
Read more >
npm Peer Dependencies - Fathom
Peer dependencies effectively declare a dependency without including the dependency in your built module. When an application includes your module, that ...
Read more >
Why use peer dependencies?
A peer dependency is a dependency of a library that isn't automatically installed. A library will often specify a peer dependency when it...
Read more >
Difference between dependencies, devDependencies and ...
A dependency is a library that a project needs to function effectively. DevDependencies are the packages a developer needs during development.
Read more >
React should be a peer dependency · Issue #1389 - GitHub
Peer dependencies can have minimum versions, the problem is normal dependencies cause a duplicate version of the library to be baked in. This ......
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