title: RequireJS: when to use 'paths' versus 'packages'
body: <p>When should I use <code>paths</code> versus <code>packages</code> in RequireJS? Is there a best practice for this or are there particular times when I should consider using one over the other?</p>
  
  <p>I've followed the docs and I came up with this:</p>
  
  <pre><code>// main.js
  requirejs.config({
      enforceDefine: true,
      urlArgs: "bust=" + (new Date()).getTime(),
      baseUrl: "./js",
      waitSeconds: 7,
      paths: {
          "jquery":     [
                          'jquery'
                        ],
          "underscore": [
                          'underscore'
                        ],
          "backbone":   [
                          'backbone'
                        ],
          "handlebars":     [
                          'handlebars'
                        ]
      },
      shim: {
          "underscore": {
              deps: [],
              exports: "_"
          },
          "backbone": {
              deps: ["jquery", "underscore"],
              exports: "Backbone"
          },
          "handlebars": {
              deps: [],
              exports: "Handlebars"
          }
      } // End shim
  
  }); // End config
  
  
  // List all files; use 'define()' and not 'require()' because of shim
  define([
      'jquery',
      'underscore',
      'backbone',
      'handlebars'
  ], function ($, _, Backbone, Handlebars)
     {
         console.log("$: " + typeof $);
         console.log("_: " + typeof _);
         console.log("Backbone: " + typeof Backbone);
         console.log("Handlebars: " + typeof Handlebars);
     }
  ); // End define
  </code></pre>
  
  <p>However, I viewed a video from Jesse Warden (<a href="http://css.dzone.com/articles/video-basics-requirejs">http://css.dzone.com/articles/video-basics-requirejs</a>) and he seems to use this style for most of his code:</p>
  
  <pre><code>// main.js
  requirejs.config({
      urlArgs: "bust=" + (new Date()).getTime(),
      baseUrl: "./js",
      waitSeconds: 7,
      packages: [
                  'main',
                  {
                      name: 'jquery',
                      location: 'libs/jquery',
                      main: 'jquery'
                  },
                  {
                      name: 'underscore',
                      location: 'libs/underscore',
                      main: 'underscore'
                  },
                  {
                      name: 'backbone',
                      location: 'libs/backbone',
                      main: 'backbone'
                  },
                  {
                      name: 'handlebars',
                      location: 'libs/handlebars',
                      main: 'handlebars'
                  }
      ]
  }); // End config
  </code></pre>
  
  <p>So which is the proper way? Should I use <code>paths</code> or <code>packages</code>? Also, there is a <code>modules</code> config. When do I use <code>modules</code>?</p>