Skip to content

Commit

Permalink
Merge pull request #1075 from conorhastings/master
Browse files Browse the repository at this point in the history
warn user when using minified code outside of NODE_ENV 'production'
  • Loading branch information
timdorr committed Jan 13, 2016
2 parents 7ef187a + 9b4754c commit ee5b52e
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 './bindActionCreators'
import applyMiddleware from './applyMiddleware'
import compose from './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 ee5b52e

Please sign in to comment.