babel-plugin-remove-proptypes

v1.0.3
Remove static declarations of React propTypes
babel-plugin

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']
});
npm i babel-plugin-remove-proptypes

Metadata

Downloads

Maintainers