gatsby-plugin-babel-remove-prop-types

Description

Gatsby plugin for removing unnecessary React propTypes from the production build by implementing babel-plugin-transform-react-remove-prop-types.

How to install

Install the plugin and its dependencies:

npm i gatsby-plugin-babel-remove-prop-types babel-plugin-transform-react-remove-prop-types

or

yarn add gatsby-plugin-babel-remove-prop-types babel-plugin-transform-react-remove-prop-types

Add the plugin to gatsby-config.js:

module.exports = {
  plugins: [
    // other plugins
    'gatsby-plugin-babel-remove-prop-types',
  ],
}

Example

In

const Baz = (props) => (
  <div {...props} />
);

Baz.propTypes = {
  className: PropTypes.string
};

Out

const Baz = (props) => (
  <div {...props} />
);