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 1d91a0c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ 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') {
var warningMessage = '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'
console.error(warningMessage) // eslint-disable-line no-console
}

export {
createStore,
combineReducers,
Expand Down

0 comments on commit 1d91a0c

Please sign in to comment.