babel-plugin-remove-proptypes

1.0.3 • Public • Published

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']
});

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-remove-proptypes

Weekly Downloads

4

Version

1.0.3

License

BSD-3-Clause

Last publish

Collaborators

  • andrewimm