diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index 2bdd83b0fc4..28b3df84593 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -101,6 +101,13 @@ module.exports = function(api, opts) { regenerator: true, }, ], + isEnvProduction && [ + // Remove PropTypes from production build + require('babel-plugin-transform-react-remove-prop-types').default, + { + removeImport: true, + }, + ], // function* () { yield 42; yield 43; } !isEnvTest && [ require('@babel/plugin-transform-regenerator').default, diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index aedc079df35..f528635cd75 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -26,6 +26,7 @@ "@babel/preset-flow": "7.0.0-beta.37", "@babel/preset-react": "7.0.0-beta.37", "babel-plugin-macros": "2.0.0", - "babel-plugin-transform-dynamic-import": "2.0.0" + "babel-plugin-transform-dynamic-import": "2.0.0", + "babel-plugin-transform-react-remove-prop-types": "0.4.12" } }