spine/spine — pull request #533 by navitmccaffery (2014-04-15 17:59:51+00:00)
Title: Use runtime value of require() in relations

This solves two issues:

1. Fix import of base `Spine` class: `relation.js` uses its own version of `require()` that can revert to `eval()` if necessary. This is fine, but since it's still got the same name, it clobbers access to the global `require()` function (which is needed on line 1 to require Spine itself if not using a global variable!). Besides this, it's confusing that the function used in `relation.js` is named the same as the global commonjs function when it doesn't do the same thing.

2. Compatibility with browserify: When using browserify, any externally-accessible modules are packaged into a custom global `require()` function. However, since you typically load your app code _after_ your libraries, Spine thinks `require()` doesn't exist and ends up reverting to the fallback `eval()` version. We should look for and use the runtime value of `require()` every time we need to fetch a model.