Skip to content

Commit 1d91a0c

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

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ 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+
var warningMessage = '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'
19+
console.error(warningMessage) // eslint-disable-line no-console
20+
}
21+
722
export {
823
createStore,
924
combineReducers,

0 commit comments

Comments
 (0)