Skip to content

Commit

Permalink
warn user when using minified code outside of NODE_ENV 'production'
Browse files Browse the repository at this point in the history
  • Loading branch information
conorhastings committed Nov 27, 2015
1 parent 9c35fd6 commit 9b4754c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ import bindActionCreators from './utils/bindActionCreators'
import applyMiddleware from './utils/applyMiddleware'
import compose from './utils/compose'

/*
* create a function so that we can check if the function name has been altered by minification
* if the function has been minified and NODE_ENV !== 'production', warn the user
*/
function isCrushed() {}

if (isCrushed.name !== 'isCrushed' && process.env.NODE_ENV !== 'production') {
/*eslint-disable no-console */
console.error('You are currently using minified code outside of NODE_ENV === \'production\'. ' +
'This means that you are running a slower development only build of Redux. ' +
'Consult tools such as loose-envify (https://github.com/zertosh/loose-envify) for browserify ' +
'and DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' +
'to build with proper NODE_ENV')
/*eslint-enable */
}

export {
createStore,
combineReducers,
Expand Down

0 comments on commit 9b4754c

Please sign in to comment.