title: Require.js Build Optimization Configuration
body: <p>I'm having a hard time getting the require.js build just right. I have a main module and then the other pages/modules are lazy loaded. When it's done compiling, I have to fix the compiled <code>dist/main.js</code> or the app will load the compiled <code>main</code> module from the <code>dist</code> folder, but other modules are still loaded from the <code>app</code> folder. I have to change the require.config baseurl from <code>/app</code> to <code>/dist</code>. What do I need to reconfigure to get it to build correctly?</p>
  
  <p><strong>Directory Structure</strong></p>
  
  <pre><code>├── app
  │   ├── modules
  │   │   ├── example_module
  │   │   ╰── another_module
  │   │       ├── AnotherController.js
  │   │       ╰── AnotherView.stache
  │   ├── main.js
  │   ╰── build.js
  ├── dist
  │   ├── modules
  │   │   ├── example_module
  │   │   ╰── another_module
  │   │       ╰── AnotherController.js
  │   ╰── main.js
  ├── content
  │   ├── css
  │   │   ╰── main.css
  │   ├── sass
  │   │   ├── table.scss
  │   │   ├── type.scss
  │   │   ├── form.scss
  │   │   ╰── main.scss
  │   ╰── img
  ├── lib
  │   ├── bootstrap
  │   ╰── canjs
  ├── bower.json
  ├── gulpfile.js
  ├── package.json
  ├── README.md
  ╰── index.html
  </code></pre>
  
  <p><strong>app/main.js</strong></p>
  
  <pre><code>require.config({
      baseUrl: '/app', // must change this after compilation!
      paths: {
          'jquery':                   '../lib/jquery/dist/jquery.min',
          'jquery-easing':            '../lib/jquery-easing-original/jquery.easing.1.3.min',
          'jquery-throttle':          '../lib/jquery-throttle-debounce/jquery.ba-throttle-debounce.min',
          'jquery-inputmask':         '../lib/jquery.inputmask/dist/jquery.inputmask.bundle.min',
          'can':                      '../lib/canjs/amd/can',
          'bootstrap':                '../lib/bootstrap-sass-official/assets/javascripts/bootstrap',
          ...
      },
      shim: {
          'jquery-easing':            ['jquery'],
          'jquery-throttle':          ['jquery'],
          'bootstrap':                ['jquery']
          ...
      }
  });
  
  require([...], function (...) {
      // Init App
  });
  </code></pre>
  
  <p><strong>app/build.js</strong></p>
  
  <pre><code>({
      appDir: '.',
      baseUrl: '.',
      dir: '../dist',
      mainConfigFile: 'main.js',
      preserveLicenseComments: false,
      modules: [
          {
              name: 'main',
              include: [
                   'modules/dashboard/DashboardController',
                   ...
              ]
          },{
              name: 'modules/example_module/ExampleController',
              exclude: ['main']
          },{
              name: 'modules/another_module/AnotherController',
              exclude: ['main']
          },{
              ...
          }
      ]
  })
  </code></pre>