title: Require.js is hurting my brain. Some fundamental questions about the way it loads scripts/modules
body: <p>Let's assume this is my config.js or main.js:</p>
  
  <pre><code>require.config({
      // paths are analogous to old-school &lt;script&gt; tags, in order to reference js scripts
      paths: {
          jquery: "libs/jquery-1.7.2.min",
          underscore: "libs/underscore-min",
          backbone: "libs/backbone-min",
          jquerymobile: "libs/jquery.mobile-1.1.0.min",
          jquerymobilerouter: "libs/jquery.mobile.router.min"
      },
      // configure dependencies and export value aliases for old-school js scripts
      shim: {
          jquery: ["require"],
          underscore: {
              deps: ["jquery"],
              exports: "_"
          },
          backbone: {
              deps: ["underscore", "jquery"],
              exports: "Backbone"
          },
          jquerymobilerouter: ["jquery", "backbone", "underscore"],
          jquerymobile: ["jquery", "jquerymobilerouter", "backbone", "underscore"]
      }
  });
  require(["jquery", "backbone", "underscore", "app/app.min", "jquerymobilerouter", "jquerymobile"], function ($, Backbone, _, App) {
      console.log($);
      console.log(Backbone);
      console.log(_);
      $("body").fadeIn(function () {
          App.init();
      });
  });
  </code></pre>
  
  <ol>
  <li><p>If I understand correctly, the <code>paths</code> config option allows you to reference scripts, a-la the <code>&lt;script&gt;</code> tag within HTML. Assuming this is the case, do I still need to alias scripts like jQuery with a <code>$</code> or underscore with a <code>_</code> in my actual require statement below? It seems strange that I'd have to, given that if you reference jQuery with a standard <code>&lt;script&gt;</code> tag, <code>$</code> can be used throughout your script automatically. Shouldn't it be the same using the <code>paths</code>?</p></li>
  <li><p>I'm new to the <code>shim</code> config option, which I understand has replaced the deprecated <code>order!</code> plugin. What does the <code>exports</code> property actually DO? It doesn't seem to create an alias for a script; for example, if I set the <code>exports</code> for underscore to <code>"whatever"</code>, and then try to <code>console.log(whatever)</code>, it's undefined. So what's the point?</p></li>
  <li><p>How would scripts like jQuery be properly used "globally?" That is, what's the proper way to be able to use the <code>$</code> alias within my App.js module, or any other module in my "app" folder? Do I have to require jQuery within every individual module and alias <code>$</code> every single time? Or is the way I've done it here the proper way?</p></li>
  </ol>
  
  <p>I'd greatly appreciate any other criticisms of this particular script as well; the documentation for Require.js, in my opinion, leaves much to be desired; things I'd really like to know more about seem to get glossed over and leave me scratching my head.</p>