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

aren't propTypes removed in production anyway? #70

Closed
faceyspacey opened this issue Feb 8, 2017 · 7 comments · Fixed by #156
Closed

aren't propTypes removed in production anyway? #70

faceyspacey opened this issue Feb 8, 2017 · 7 comments · Fixed by #156

Comments

@faceyspacey
Copy link

I'm wondering because I'm trying to determine the correct usage for an open source package. I'm thinking it shouldn't be set only in development so that users can decide.

@brigand
Copy link
Owner

brigand commented Feb 9, 2017

Hmm... we might want to add an option for adding a NODE_ENV check so minifiers can strip it for production.

@faceyspacey
Copy link
Author

yea, but aren't the propTypes removed in production automatically??

@brigand
Copy link
Owner

brigand commented Feb 10, 2017

Nope. React doesn't check them in production, but they're still in the code.

@brigand brigand closed this as completed Feb 10, 2017
@sohkai
Copy link

sohkai commented Dec 12, 2017

Hmm... we might want to add an option for adding a NODE_ENV check so minifiers can strip it for production.

@brigand Was this ever implemented? AFAIK consumers of a library won't be able to run babel plugins like babel-plugin-transform-react-remove-prop-types on their imports unless they get messy with their node_modules so the only chance they have of stripping out prop types would be if the library had their prop types under NODE_ENV flags.

@brigand
Copy link
Owner

brigand commented Dec 12, 2017

Yeah, we could add this, and since require('prop-types') is inline, it'll get hit by dead code elimination. I'll be pretty busy the next few days, but I'll add a reminder to do this if no one gets to it first.

@sohkai
Copy link

sohkai commented Dec 13, 2017

Cool! I don't mind helping out if you need some :).

@brigand
Copy link
Owner

brigand commented Dec 13, 2017

@sohkai I'd love some help!

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.

3 participants