Could react be a peer dependency rather than a dependency?
See original GitHub issueAt 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:
- Created 2 years ago
- Comments:19 (15 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
3.0.0-dev.4
and newer now have React as peer dep.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-transformJust put up a PR to permit React 16 as a peer dependency