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 2da0dea
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ 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 atlered 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') {
console.error('You are utilzing 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-disable-line no-console
}

export {
createStore,
combineReducers,
Expand Down

0 comments on commit 2da0dea

Please sign in to comment.