title: Using RequireJS to load dojo modules
body: <p>I am hosting ArcGIS JS API 4.1 locally in my project, so I have build the esri componenet and I have added the path in my requireJS config file. I also wanted to build the dojo folder, so basically build it to a single output file. But when I add the dojo modules using requireJS bundles I get an error in the esri file that e is not a function(…). The line of code that it appears on is:</p>
  
  <pre><code>define("dojo/_base/config", ["../has", "require"], function(e, t) {
      var r = {};
      if (e("dojo-config-api")) { ... }  //e is undefined.
  </code></pre>
  
  <p>I get that the error means dojo/has is undefined but I don't understand why. I tried using dojo/has in my project and it is not undefined but in the esri file it says its undefined. Does anybody know how I can fix this.</p>
  
  <p>This is requireJS config file:</p>
  
  <pre><code>requirejs.config({
      paths: {
          "jquery": 'https://code.jquery.com/jquery-3.1.0.min',
          'esri/moment': 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment',
          "esri": "../lib/arcgis-js-api-4/main",
         "dojo": "../lib/arcgis-js-api-4/dojo-lib",
         "dojox": 'http://js.arcgis.com/4.1/dojox',
         "dijit": 'http://js.arcgis.com/4.1/dijit'
  },
  bundles: {
          "esri": ["esri/Color",...],
        'dojo': ['dojo/has', 'dojo/domReady',...]
  },shim: {
      "esri": {
              deps: ["esri/moment", "dojo", "dojox", "dijit"]
          }
  }
  });
  </code></pre>
  
  <p>This is the config for the dojo build:</p>
  
  <pre><code>var profile=(function(){
      return {
          basePath: "./",
          releaseDir: "./",
          releaseName: "dojoLib",
          action: "release",
          cssOptimize: 'comments',
          layerOptimize: false,
          packages:[{
                  name: "dojo",
                  location: "src/dojo"
              }],
          layers:{
              "dojo/dojoLib": {
                  include: ["dojo/dojo", "dojo/i18n", "dojo/domReady", 'dojo/has', 'dojo/request', 'dojo/request/xhr',
                  'dojo/request/util', 'dojo/request/watch', 'dojo/io/script', 'dojo/io/iframe', 'dojo/query'],
                  customBase: true,
                  boot: false    
              }
          }
      };
  })();
  </code></pre>