React should be a peer dependencies
See original GitHub issuehttps://github.com/kiegroup/kogito-tooling/blob/master/packages/core-api/package.json#L15-L18
One think I noticed working on the AtlasMap POC is that I was getting the Invalid Hook Call Warning
error in the console. Ultimately, it was due to @kogito/core-api
declaring React as direct dependency, which causes for multiple versions of React being embedded in the bundle. Since AtlasMap is written solely using hooks, this issue come up immediately.
A quick workaround was to instruct WebPack to consider React an external dependency, but it would be better to make React and React DOM peer dependencies in the core-api
package.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
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 ...
peerDependencies specifies which version(s) of React your reusable component supports/requires. When using npm 2 this also adds React to the ...
Read more >Why use peer dependencies?
A library will often specify a peer dependency when it wants a dependency to be ... and @mdx-js/react ) are peer dependencies of...
Read more >npm Peer Dependencies - Fathom
For example, if you are building a library of React components, React will be a dependency you need, but almost certainly the application...
Read more >React should be a peer dependency · Issue #1389
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 FreeTop 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
Top GitHub Comments
I mean, your project your rules 😄
Let’s say that this would be quite an exception in the npm ecosystem and would limit peers to use the provided template and tools (what if I don’t want to use webpack? Sure things like rollup allow for declaring external global dependencies, but I don’t see why adding this cognitive burden to users).
Yup I think I’m with you. If I may, check out tsdx as a library boilerplate generator. It uses rollup under the hood that’s more suited to create libraries than webpack and makes working with this stuff easier.