Skip to content

Commit a00cae7

Browse files
iansugaearon
authored andcommitted
Remove PropTypes from production build (#209) (#3818)
* Remove PropTypes from production build (#209) * Added react/forbid-foreign-prop-types rule to eslint config * Removed react/forbid-foreign-prop-types rule from eslint config
1 parent 82907fd commit a00cae7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/babel-preset-react-app/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ module.exports = function(api, opts) {
101101
regenerator: true,
102102
},
103103
],
104+
isEnvProduction && [
105+
// Remove PropTypes from production build
106+
require('babel-plugin-transform-react-remove-prop-types').default,
107+
{
108+
removeImport: true,
109+
},
110+
],
104111
// function* () { yield 42; yield 43; }
105112
!isEnvTest && [
106113
require('@babel/plugin-transform-regenerator').default,

packages/babel-preset-react-app/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@babel/preset-flow": "7.0.0-beta.37",
2727
"@babel/preset-react": "7.0.0-beta.37",
2828
"babel-plugin-macros": "2.0.0",
29-
"babel-plugin-transform-dynamic-import": "2.0.0"
29+
"babel-plugin-transform-dynamic-import": "2.0.0",
30+
"babel-plugin-transform-react-remove-prop-types": "0.4.12"
3031
}
3132
}

0 commit comments

Comments
 (0)