Skip to content

Commit 5b4b201

Browse files
committed
remove prop-types in production build (reduxjs#943)
1 parent a78e6d5 commit 5b4b201

File tree

7 files changed

+51
-25
lines changed

7 files changed

+51
-25
lines changed

.babelrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
"plugins": [
3838
"external-helpers"
3939
]
40+
},
41+
"rollup-production": {
42+
"plugins": [
43+
"external-helpers",
44+
["transform-react-remove-prop-types", { "removeImport": true }]
45+
]
46+
},
47+
"production": {
48+
"plugins": [
49+
["transform-react-remove-prop-types", { "removeImport": true }]
50+
]
4051
}
4152
}
4253
}

package-lock.json

Lines changed: 31 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
3131
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
3232
"build:umd": "cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c -o dist/react-redux.js",
33-
"build:umd:min": "cross-env BABEL_ENV=rollup NODE_ENV=production rollup -c -o dist/react-redux.min.js",
33+
"build:umd:min": "cross-env BABEL_ENV=rollup-production NODE_ENV=production rollup -c -o dist/react-redux.min.js",
3434
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
3535
"clean": "rimraf lib dist es coverage",
3636
"lint": "eslint src test/utils test/components",
@@ -46,7 +46,6 @@
4646
"hoist-non-react-statics": "^2.5.5",
4747
"invariant": "^2.2.4",
4848
"loose-envify": "^1.1.0",
49-
"prop-types": "^15.6.1",
5049
"react-is": "^16.4.2",
5150
"shallow-equals": "^1.0.0"
5251
},
@@ -78,6 +77,7 @@
7877
"babel-plugin-transform-object-rest-spread": "^6.26.0",
7978
"babel-plugin-transform-react-display-name": "^6.4.0",
8079
"babel-plugin-transform-react-jsx": "^6.4.0",
80+
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
8181
"codecov": "^3.0.2",
8282
"create-react-class": "^15.6.3",
8383
"cross-env": "^5.2.0",
@@ -90,6 +90,7 @@
9090
"jest": "^23.4.1",
9191
"jest-dom": "^1.12.0",
9292
"npm-run": "^5.0.1",
93+
"prop-types": "^15.6.2",
9394
"react": "^16.4.2",
9495
"react-dom": "^16.4.2",
9596
"react-testing-library": "^5.0.0",

rollup.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const config = {
2828
commonjs({
2929
namedExports: {
3030
'node_modules/react-is/index.js': ['isValidElementType'],
31-
'node_modules/prop-types/index.js': ['oneOfType', 'func', 'object']
3231
}
3332
})
3433
]

src/components/Provider.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { Component } from 'react'
22
import PropTypes from 'prop-types'
33
import { Provider as ContextProvider } from './Context'
4-
import { storeShape } from '../utils/PropTypes'
54

65
class Provider extends Component {
76
constructor(props) {
@@ -69,7 +68,11 @@ class Provider extends Component {
6968
}
7069

7170
Provider.propTypes = {
72-
store: storeShape.isRequired,
71+
store: PropTypes.shape({
72+
subscribe: PropTypes.func.isRequired,
73+
dispatch: PropTypes.func.isRequired,
74+
getState: PropTypes.func.isRequired
75+
}),
7376
context: PropTypes.object,
7477
children: PropTypes.any
7578
}

src/components/connectAdvanced.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import hoistStatics from 'hoist-non-react-statics'
22
import invariant from 'invariant'
33
import React, { Component, PureComponent } from 'react'
4-
import * as propTypes from 'prop-types'
4+
import propTypes from 'prop-types'
55
import shallowEqual from 'shallow-equals'
66
import { isValidElementType } from 'react-is'
77

src/utils/PropTypes.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)