title: How does Backbone.$ get set in CommonJS modules configuration?
body: <p>I was going through the Backbone.js source code copied below from <a href="http://backbonejs.org/backbone.js" rel="nofollow">http://backbonejs.org/backbone.js</a></p>
  
  <pre><code>(function(root, factory) {
  
    // Set up Backbone appropriately for the environment. Start with AMD.
    if (typeof define === 'function' &amp;&amp; define.amd) {
      define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
        // Export global even in AMD case in case this script is loaded with
        // others that may still expect a global Backbone.
        root.Backbone = factory(root, exports, _, $);
      });
  
    // Next for Node.js or CommonJS. jQuery may not be needed as a module.
    } else if (typeof exports !== 'undefined') {
      var _ = require('underscore');
      factory(root, exports, _);
  
    // Finally, as a browser global.
    } else {
      root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
    }
  
  }(this, function(root, Backbone, _, $) {
  
    // Initial Setup
    // -------------
  
    // Save the previous value of the `Backbone` variable, so that it can be
    // restored later on, if `noConflict` is used.
    var previousBackbone = root.Backbone;
  
    // Create local references to array methods we'll want to use later.
    var array = [];
    var push = array.push;
    var slice = array.slice;
    var splice = array.splice;
  
    // Current version of the library. Keep in sync with `package.json`.
    Backbone.VERSION = '1.1.2';
  
    // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
    // the `$` variable.
    Backbone.$ = $;
  </code></pre>
  
  <p>In the CommonJS/node.js configuration, it says <code>Next for Node.js or CommonJS. jQuery may not be needed as a module.</code> and calls <code>factory(root, exports, _)</code> with the fourth <code>$</code> param for jquery as undefined. In the factory function it goes <code>Backbone.$ = $</code> so <code>Backbone.$</code> would be undefined? Then wouldn't a lot of stuff (AJAX, <code>$el</code> wrapping, etc.) break? </p>