Skip to content

Commit

Permalink
Remove PropTypes from production build (facebook#209) (facebook#3818)
Browse files Browse the repository at this point in the history
* Remove PropTypes from production build (facebook#209)

* Added react/forbid-foreign-prop-types rule to eslint config

* Removed react/forbid-foreign-prop-types rule from eslint config
  • Loading branch information
iansu authored and akstuhl committed Mar 15, 2018
1 parent ae2c59c commit 8e817a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/babel-preset-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-preset-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 8e817a1

Please sign in to comment.