Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropType validators error when an external lib bundles prop-types #38

Closed
OscarBarrett opened this issue Apr 26, 2017 · 4 comments · Fixed by #50
Closed

PropType validators error when an external lib bundles prop-types #38

OscarBarrett opened this issue Apr 26, 2017 · 4 comments · Fixed by #50

Comments

@OscarBarrett
Copy link

If an external lib containing React components bundles prop-types the validators error is thrown when one of the components is used.

The solution (for webpack) is to add prop-types to externals in the webpack config and add it as a peerDependency.

This should probably be mentioned in the readme and/or in https://github.com/facebook/react/blob/master/docs/warnings/dont-call-proptypes.md

@gaearon
Copy link
Contributor

gaearon commented May 12, 2017

Can you provide a standalone example demonstrating the issue? I don't fully understand what's going on.

OscarBarrett added a commit to OscarBarrett/prop-types-externals-example that referenced this issue May 12, 2017
@OscarBarrett
Copy link
Author

I've created a simple example here.

@gaearon
Copy link
Contributor

gaearon commented May 12, 2017

I think the issue occurs because you're using a production build of the library with a development build of React.

@gaearon
Copy link
Contributor

gaearon commented May 12, 2017

Fixed this in prop-types@15.5.10. If a library whose UMD build you're using updates and rebuilds, this should no longer be an issue. Thank you so much for the reproducible example—I wouldn't have fixed it so quickly otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants