draft-js-typeahead icon indicating copy to clipboard operation
draft-js-typeahead copied to clipboard

Fix dependencies

Open chrisui opened this issue 7 years ago • 4 comments

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.

chrisui avatar Feb 20 '17 17:02 chrisui

We might also need to define these as externals in any webpack config?

Edit: have done that (I think..)

chrisui avatar Feb 20 '17 17:02 chrisui

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 avatar Feb 20 '17 19:02 jvaill

@jvaill - add them as dev dependencies - and build your examples with them

juliankrispel avatar Mar 07 '17 23:03 juliankrispel

Hi, this is bugging me too. The solution by @juliankrispel sounds good to me. @chrisui can you duplicate those dependencies to dev too please?

danielkcz avatar Jun 06 '17 12:06 danielkcz