title: RequireJS: How to exclude certain paths when building to single file?
body: <p>I have a Backbone app which uses RequireJS 2.1.8 (i.e., all my Backbone views use define() to specify their dependencies). Everything works great and now I'm trying to use r.js (installed via NPM) to concat/minify all of my JavaScript into a single file.</p>
  
  <p><strong>How can I set up a r.js config which excludes dependencies that begin with certain paths?</strong></p>
  
  <p>I've included my main.js file below. In this case, I want the "built" output file to exclude the 3rd-party libraries (i.e., jquery, backbone, etc.). Also, I want to exclude any dependency that starts with "webapp/" (e.g., "webapp/dynamic_cfg", which results in a request being sent to my Djang app for a dynamically-generated JavaScript file/module). </p>
  
  <p>Folder structure:</p>
  
  <pre><code>|--static/
      |--main.js
      |--myapp/
          |--views/
              |-- MyView.js
              |-- ...
      |--lib
          |--backbone-1.0/
          |--underscore-1.5.1/
          |-- ...
  </code></pre>
  
  <p>index.html (a Django template):</p>
  
  <pre><code>&lt;script src="{% static 'lib/requirejs-2.1.8/require.min.js' %}" data-main="{% static 'main.js' %}" &gt;&lt;/script&gt;
  </code></pre>
  
  <p>main.js:</p>
  
  <pre><code>requirejs.config({
  
      paths: {
          "jquery": 'lib/jquery-1.10.2/jquery.min',
          "text_loader": 'lib/requirejs-text-2.0.10/requirejs-text',
          "fuelux": 'lib/fuelux-2.3.1',
          "backbone": 'lib/backbone-1.0/backbone.min',
          "underscore": 'lib/underscore-1.5.1/underscore.min',
  
          // Any module that requires 'webapp/*' will result Require.js
          // making a request to the server webapp.
          "webapp": '..'
      },
  
      shim: {
  
          'backbone': {
              deps: ['underscore', 'jquery'], // Load these dependencies first
              exports: 'Backbone' // Create global var with this name for the module
          },
          'underscore': {
              exports: '_'
          }
      }
  
  });
  
  // Startup
  require(['webapp/dynamic_cfg', 'myapp/util/logger', 'myapp/view/AppView', 'myapp/AppRouter', 'fuelux/all'],
  
      // Dependencies are loaded and passed to this function
      function(cfg, logger, AppView, AppRouter, fuelUx) {
  
          logger.info("Starting up with config:", cfg);
  
          var appView = new AppView();
          var appRouter = new AppRouter();
      }
  );
  </code></pre>