Skip to content

Commit

Permalink
remove prop-types in production build (reduxjs#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
cellog committed Aug 13, 2018
1 parent a78e6d5 commit 5b4b201
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 25 deletions.
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
"plugins": [
"external-helpers"
]
},
"rollup-production": {
"plugins": [
"external-helpers",
["transform-react-remove-prop-types", { "removeImport": true }]
]
},
"production": {
"plugins": [
["transform-react-remove-prop-types", { "removeImport": true }]
]
}
}
}
43 changes: 31 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build:umd": "cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c -o dist/react-redux.js",
"build:umd:min": "cross-env BABEL_ENV=rollup NODE_ENV=production rollup -c -o dist/react-redux.min.js",
"build:umd:min": "cross-env BABEL_ENV=rollup-production NODE_ENV=production rollup -c -o dist/react-redux.min.js",
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
"clean": "rimraf lib dist es coverage",
"lint": "eslint src test/utils test/components",
Expand All @@ -46,7 +46,6 @@
"hoist-non-react-statics": "^2.5.5",
"invariant": "^2.2.4",
"loose-envify": "^1.1.0",
"prop-types": "^15.6.1",
"react-is": "^16.4.2",
"shallow-equals": "^1.0.0"
},
Expand Down Expand Up @@ -78,6 +77,7 @@
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-display-name": "^6.4.0",
"babel-plugin-transform-react-jsx": "^6.4.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
"codecov": "^3.0.2",
"create-react-class": "^15.6.3",
"cross-env": "^5.2.0",
Expand All @@ -90,6 +90,7 @@
"jest": "^23.4.1",
"jest-dom": "^1.12.0",
"npm-run": "^5.0.1",
"prop-types": "^15.6.2",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-testing-library": "^5.0.0",
Expand Down
1 change: 0 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const config = {
commonjs({
namedExports: {
'node_modules/react-is/index.js': ['isValidElementType'],
'node_modules/prop-types/index.js': ['oneOfType', 'func', 'object']
}
})
]
Expand Down
7 changes: 5 additions & 2 deletions src/components/Provider.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Provider as ContextProvider } from './Context'
import { storeShape } from '../utils/PropTypes'

class Provider extends Component {
constructor(props) {
Expand Down Expand Up @@ -69,7 +68,11 @@ class Provider extends Component {
}

Provider.propTypes = {
store: storeShape.isRequired,
store: PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
}),
context: PropTypes.object,
children: PropTypes.any
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/connectAdvanced.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import hoistStatics from 'hoist-non-react-statics'
import invariant from 'invariant'
import React, { Component, PureComponent } from 'react'
import * as propTypes from 'prop-types'
import propTypes from 'prop-types'
import shallowEqual from 'shallow-equals'
import { isValidElementType } from 'react-is'

Expand Down
7 changes: 0 additions & 7 deletions src/utils/PropTypes.js

This file was deleted.

0 comments on commit 5b4b201

Please sign in to comment.