facebook/react — pull request #1572 by spicyj (2014-05-20 03:11:43+00:00)
Title: When packaging, copy the code and inline `__DEV__`

Fixes #812.

Previously, this code

module.exports = moo();
function moo() { return __DEV__; }

would be transformed to

module.exports = moo();
function moo() { return "production" !== process.env.NODE_ENV; }

Now, it's transformed to:

if ("production" !== process.env.NODE_ENV) {
var moo = function() { return true; };
module.exports = moo();
} else {
var moo = function() { return false; };
module.exports = moo();
}

which reduces the getter cost to one test at require time instead of inline for every `__DEV__` check, warning, and invariant.

The unminified build is about twice as large now (but it's about the same after gzipping) and the minified build is the same size.