Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added lodash and react to dependencies list since peerDependencies wi…
…ll be deprecated from npm
- Loading branch information
860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this isn't right as this will make NPM potentially download additional versions of React leading to the dreaded bug facebook/react#1939 (I've seriously run into this maybe a dozen or more times)
860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But npm keeps spewing a warning that peerDependencies will be deprecated - webpack-contrib/url-loader#12.
As far as i know the only way to get around it is to ensure that library you use has a stricter version requirement for react and the consumer ensure at their end that the versions they have are similar to the version used in the third party library.
as for double downloads, i think bundlers like webpack and browserify might take care of it. In the latest setup the lib folder contains a bundled file for ReactTelephoneInput produced by browserify which does not have react bundled.
860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the best thing to do is to not put React in dependencies or peerDependencies. I would assume anyone using this module already has React installed. Leaving Lodash as a dependency is less of a problem I think.
860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a fair assumption to make considering it's a react component :). And for testing, having react as devDependency should suffice. Only problem is we need to convey somehow the version of react this component is compatible with. For now it seems to be compatible with both 0.12.* and 0.13.*.
860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some good discussion here too - formatjs/formatjs#79
I don't know if having the dependency range as
"react": ">=0.11.2 <0.14.0"
will solve the problem?860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just state compatibility range in readme?
860b56a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not better to have an automated hard restriction which tells you about conflicts or non compatibility during the time of installation?