Skip to content

Commit dee4645

Browse files
committed
warn user when using minified code outside of NODE_ENV 'production'
1 parent 9c35fd6 commit dee4645

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ import bindActionCreators from './utils/bindActionCreators'
44
import applyMiddleware from './utils/applyMiddleware'
55
import compose from './utils/compose'
66

7+
/*
8+
* create a function so that we can check if the function name has been atlered by minification
9+
* if the function has been minified and NODE_ENV !== 'production', warn the user
10+
*/
11+
function isCrushed() {}
12+
13+
if (isCrushed.name !== 'isCrushed' && process.env.NODE_ENV !== 'production') {
14+
/*eslint-disable no-console */
15+
console.error('You are utilzing minified code outside of NODE_ENV === \'production\'. ' +
16+
'This means that you are running a slower development only build of Redux. ' +
17+
'Consult tools such as loose-envify (https://github.com/zertosh/loose-envify) for browserify ' +
18+
'and DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' +
19+
'to build with proper NODE_ENV')
20+
/*eslint-enable */
21+
}
22+
723
export {
824
createStore,
925
combineReducers,

0 commit comments

Comments
 (0)