babel-plugin-remove-proptypes
v1.0.3
Published
Remove static declarations of React propTypes
Downloads
20
Readme
babel-plugin-remove-proptypes
Babel plugin for removing static declarations of React propTypes
on classes.
Input:
// MyComponent extends React.Component
MyComponent.propTypes = {
someString: React.PropTypes.string.isRequired,
someBoolean: React.PropTypes.bool
};
Output:
// Does not contain any propTypes declarations
The plugin can be used to remove PropTypes from production environments, where they have no effect.
Installation
$ npm install babel-plugin-remove-proptypes
Usage
Via .babelrc
{
"plugins": ["remove-proptypes"]
}
Via CLI
$ babel --plugins remove-proptypes script.js
Via Node API
require('babel-core').transform('code', {
plugins: ['remove-proptypes']
});