1.0.1 • Published 5 years ago

babel-plugin-react-prop-types-remover v1.0.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
5 years ago

babel-plugin-react-prop-types-remover

Babel plugin for removing React's propTypes declarations in production builds.

Installation

npm install babel-plugin-react-prop-types-remover --save-dev

Usage

CLI

$ browserify script.js -o bundle.js -t [ babelify --plugins [ babel-plugin-react-prop-types-remover ] ]

Node

var fs = require('fs');
var browserify = require('browserify');
browserify('./script.js')
  .transform('babelify', { plugins: ['babel-plugin-react-prop-types-remover'] })
  .bundle()
  .pipe(fs.createWriteStream('bundle.js'));

Example

script.js:

class Foo {
  static get baz() {}

  static get propTypes() {}

  get myFo() {}

  bar() {}
}

will be transformed to bundle.js:

class Foo {
  static get baz() {}

  get myFo() {}

  bar() {}
}