title: grunt requirejs ignores paths from my mainConfigFile
body: <h2>Project Intro</h2>
  
  <p>My project is a single page storefront. The project has multiple modules, and each module contains a set of controller.js, view.js and model.js files, as well as a template.html file. And uses requirejs to manage dependencies.</p>
  
  <h2>Problem Statement</h2>
  
  <p>I want to use mainConfigFile to provide paths to reference modules in grunt-requirejs. 
  Part of my mainConfigFile's require.config is stored in separate file (base.dependency.config),  and require.config.paths are pieced together by underscore at runtime. </p>
  
  <p><strong>base.dependency.config</strong></p>
  
  <pre><code>config = {
      baseDependencyConfig: {
          paths: { ... }
          shim: { ... }
      }
  }
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>var dependencies = config.baseDependencyConfig;
  var basePaths = config.baseDependencyConfig.paths;
  var extensionPaths = {
      // extra sets of paths
  };
  
  // combine base paths and extension paths at runtime using underscore
  var dependencyPaths = _.extend(basePaths, extensionPaths);
  
  dependencies.paths = dependencyPaths;
  require.config(dependencies);
  
  // application startup
  require(['app', 'eventbus']) {
      // code
  }
  </code></pre>
  
  <h2>Error</h2>
  
  <p>However, grunt requirejs is ignoring mainConfigFile, grunt requirejs tries to find 'app.js' under root, when in fact, 'app' is defined under require.config paths as </p>
  
  <pre><code>'app': 'modules/base/app/base.app.controller'
  </code></pre>
  
  <h2>my gruntFile:</h2>
  
  <pre><code>module.exports = function (grunt) {
      grunt.initConfig({
          // ... other plugin config
          requirejs: {
              options: {
                  baseUrl: 'public',
                  // the paths for the named modules such as 'app' are defined 
                  // in main.js under require.config paths
                  name: 'main',
                  include: [
                      'app',
                      'cart',
                      'category'
          ],
          out: 'public/build/app-optimized.js',
          mainConfigFile: 'public/main.js',
          findNestedDependencies: true,
          optimizeCss: 'none',
          cssImportIgnore: 'style/style.css, style/mocha.css',
              }
          }
      })
  }
  </code></pre>
  
  <h2>my file structure</h2>
  
  <pre><code>public
      |--modules/
      |       |--base/
      |       |       |--cart
      |       |       |--category
      |       |               |--category.controller.js
      |       |               |--category.view.js
      |       |               |--category.model.js
      |       |               └-category.template.html
      |       |
      |       └--extension/
      |
      |--style/
      |--image/
      |--main.js &lt;-- main config file
      |--other .js files
  </code></pre>
  
  <ul>
  <li>mainConfigFile, main.js lives in root, along with a few other application startup js files</li>
  <li>main bulk of application files lives inside modules folder</li>
  <li>each module folder contains its controller, view and model js file, as well as a template.html file</li>
  </ul>
  
  <h2>Edit</h2>
  
  <p>the gruntFile worked before, with different mainConfigFile (main.js) setup:</p>
  
  <pre><code>require.config({
      paths: {...}
      shim: {...}
  })
  
  // application startup
  require(['app', 'eventbus']) {
      // code
  }
  </code></pre>