Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

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} />
);
© 2024 Gatsby, Inc.