facebook/react — pull request #627 by petehunt (2013-12-02 11:11:21+00:00)
Title: react-core npm module

This was challenging for two reasons:

* Accessing internals is hard
* __DEV__
* You can't `require()` the browserified code via UMD (not a showstopper but annoying)

This solves the first problem by just stealing @zpao's https://github.com/facebook/react/pull/442. Now you can `require('React/lib/EventPluginRegistry')` and inject your own event plugins. I don't think we should document this until we shore up our API. However, I think this is enough to publish `TapEventPlugin` (perhaps as a separate npm module)

The second is solved by using `envify` which will do a syntax transform to substitute the `NODE_ENV` environment variable (see http://www.hacksparrow.com/running-express-js-in-production-mode.html). So this will transparently work and I tested that it stripped invariants and `__DEV__` branches. Additionally I required the transform in `package.json` so they can just transparently use this package and not worry about `__DEV__` at all!

The third is solved by introducing muffinizing! Hell yeah! I just replaced every instance of the word `require` in the browserified code with `muffin`. This is actually pretty much the only way this will work since many packaging systems look for calls to a function named `require()`. cc @epriestley

I suggest we follow this up by deprecating react-addons, moving each addon to its own npm package and having a "react-with-addons" npm package that just depends on the other stuff and can be browserified with `wzrd.in`.