powmedia/backbone-forms — pull request #309 by alexstrat (2013-10-22 10:25:45+00:00)
Title: CommonJS and browserify support

Hi,

I tried to use backbone-forms with [browserify](http://browserify.org/) (~ CommonJS bundler), but I got some issues:
- `browserify` uses `main` field of `package.json` to find the file to bundle. However, here, the `main` field points to the AMD bundle. So i added the [`browser` field](https://gist.github.com/defunctzombie/4339901) that `browserify` understands.
- in nodejs's CommonJS module and, thus, in browserify, the global `this` does not refer to the global object. Then, [`root`](https://github.com/powmedia/backbone-forms/blob/master/distribution/backbone-forms.js#L9) is not what it's expected. I changed that to explicitly pass `window || global || this` (in `browserify`, *global = window*)