-
Notifications
You must be signed in to change notification settings - Fork 61
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
Wrapping propTypes with an environment check instead of removing them #35
Comments
That sounds like a very good idea! |
I'm working on it, it shouldn't be too hard, I'm already doing it here https://github.com/oliviertassinari/babel-plugin-transform-dev-warning/blob/master/src/index.js#L23. |
@insin I have done a first iteration for this feature. I still miss the stage-1 class static syntax. |
Amazing, thanks! Looking forward to integrating this into my React component build setup 👍 |
@insin I'm gonna add it to Material-UI too 🎉 . I have two unsupported cases:
|
Would it be feasible to wrap
propType
definitions in aif (process.env.NODE_ENV !== 'production')
check (extracting them out first if they're part of aReact.createClass()
) instead of removing them completely?This plugin is great and solves the problem of removing my own redundant
propTypes
for production, but it would be cool if it could also be adopted by authors transpiling reusable components to publish to npm, so your dependencies'propTypes
could be available in development and test as normal, but automatically removed for production via the usual dead-code elimination process.Could that be made an option into this plugin? Remove vs. move/wrap?
The text was updated successfully, but these errors were encountered: