Skip to content

Commit 2da0dea

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

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ 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+
console.error('You are utilzing minified code outside of NODE_ENV === \'production\'. ' +
15+
'This means that you are running a slower development only build of Redux. ' +
16+
'Consult tools such as loose-envify (https://github.com/zertosh/loose-envify) for browserify ' +
17+
'and DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' +
18+
'to build with proper NODE_ENV') // eslint-disable-line no-console
19+
}
20+
721
export {
822
createStore,
923
combineReducers,

0 commit comments

Comments
 (0)