draft-js-typeahead
draft-js-typeahead copied to clipboard
Fix dependencies
Currently trying to use this library will result in the error seen below.
Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).
Can read more here.
Dependencies on React, DraftJS or their peer dependencies should be defined as "peerDependencies"
in package.json
otherwise you will end up with duplicate instances where semver is not precise enough (rare).
It should be up to the consumer to define versions of these dependencies as they see fit.
We might also need to define these as externals in any webpack config?
Edit: have done that (I think..)
Thanks for opening this up!
It looks like the examples stop working after moving to"peerDependencies"
since they're explicitly referencing dist builds from node_modules
(e.g. https://github.com/dooly-ai/draft-js-typeahead/blob/master/examples/mentions/mentions.html#L14).
Any idea what we can do here?
@jvaill - add them as dev dependencies - and build your examples with them
Hi, this is bugging me too. The solution by @juliankrispel sounds good to me. @chrisui can you duplicate those dependencies to dev too please?