Skip to content

Wrapping propTypes with an environment check instead of removing them #35

@insin

Description

@insin

Would it be feasible to wrap propType definitions in a if (process.env.NODE_ENV !== 'production') check (extracting them out first if they're part of a React.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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions