title: Dojo 1.10 Custom Build output directory location wrong
body: <p>I am trying to implement the general example illustrated in:
  <a href="https://dojotoolkit.org/documentation/tutorials/1.10/modules_advanced/" rel="nofollow noreferrer">https://dojotoolkit.org/documentation/tutorials/1.10/modules_advanced/</a></p>
  
  <p>where my directory structure does not match the "default". </p>
  
  <pre><code>/
      index.html
      js/
          lib/
              dojo/
              dijit/
              dojox/
          my/
  </code></pre>
  
  <p>When I run against the development directories, everything works great! Using this config at runtime:</p>
  
  <pre><code>&lt;script&gt;
              var dojoConfig = {
                  baseUrl: "/lib/_site/js/",
                  tlmSiblingsofDojo: false,
                  async: 1,
                  hasCache: {
                      // these are the values given above, not-built client code may test for these so they need to be available
                      "dojo-built": 1,
                      "dojo-loader": 1,
                      "dojo-undef-api": 0,
                      dom: 1,
                      "host-browser": 1,
  
                      // Disable deferred instrumentation by default in the built version.
                      "config-deferredInstrumentation": 0,
  
                      // Dojo loader has built-in "has" api. Since dojoConfig is used
                      // by Dojo loader, we can set the default here.
                      "dojo-has-api": 1,
  
                      // default
                      "config-selectorEngine": "lite",
  
                      "esri-featurelayer-webgl": 0,
  
                      "esri-promise-compatibility": 0,
                      "esri-promise-compatibility-deprecation-warnings": 1
                  },
                  packages: [
                      {
                          name: "dojo",
                          location: "lib/dojo"
                      },
                      {
                          name: "dijit",
                          location: "lib/dijit"
                      },
                      {
                          name: "dojox",
                          location: "lib/dojox"
                      },
                      {
                          name: "dstore",
                          location: "lib/dstore"
                      },
                      {
                          name: "dgrid",
                          location: "lib/dgrid"
                      },
                      {
                          name: "esri",
                          location: "lib/esri"
                      },
                      {
                          name: "moment",
                          location: "lib/moment",
                          main: "moment"
                      },
                      {
                          name: "my",
                          location: "my",
                          main: "app"
                      }
                  ]
              };
  
          &lt;/script&gt;
          &lt;script src="~/lib/_site/dist/js/lib/dojo/dojo.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Dojo correctly locates "my" and the other "libs". But if I try to do an optimized custom build for production, everything works the same except the "my" directory is copied to the "lib" directory, but dojo is still looking for it where it should be? </p>
  
  <p>The output directories look like:</p>
  
  <pre><code>/
          index.html
          js/
              lib/
                  dojo/
                  dijit/
                  dojox/
                  my/
  </code></pre>
  
  <p>I am using this profile to build the optimized package..</p>
  
  <pre><code>*
   * Based on the dojo-boilerplate
   * https://github.com/csnover/dojo-boilerplate
   * and https://github.com/tomwayson/esri-slurp-example
   *
   * Please refer to the Dojo Build tutorial for more details
   * http://dojotoolkit.org/documentation/tutorials/1.10/build/
   * Look to `util/build/buildControlDefault.js` for more information on available options and their default values.
   */
  
  var profile = {
      optimizeOptions: {
          languageIn: "ECMASCRIPT6",
          languageOut: "ECMASCRIPT5"
      },
  
      // `basePath` is relative to the directory containing this profile file; in this case, it is being set to the
      // src/ directory, which is the same place as the `baseUrl` directory in the loader configuration.
      basePath: "./js/",
      tlmSiblings:false,
      action: "release",
      optimize: "closure", // requires Java 6 or later: http://code.google.com/p/closure-compiler/wiki/FAQ
      layerOptimize: "closure",
      useSourceMaps: false,
      cssOptimize: "comments",
      copyTests: false,
      internStrings: true,
      mini: true,
  
      // The default selector engine is not included by default in a dojo.js build in order to make mobile builds
      // smaller. We add it back here to avoid that extra HTTP request. There is also an "acme" selector available; if
      // you use that, you will need to set the `selectorEngine` property in index.html, too.
      selectorEngine: "lite",
      // Strips all calls to console functions within the code. You can also set this to "warn" to strip everything
      // but console.error, and any other truthy value to strip everything but console.warn and console.error.
      // This defaults to "normal" (strip all but warn and error) if not provided.
      stripConsole: "none",
  
      // dojoBootText: "require.boot &amp;&amp; require.apply(null, require.boot);",
      insertAbsMids: 0,
      // If present and truthy, instructs the loader to consume the cache of layer member modules
      noref: true,
  
      // A list of packages that will be built. The same packages defined in the loader should be defined here in the
      // build profile.
      packages: [
          // "app" is a sample path for your application
          // set this accordingly
          {
              name: "my",
              location: "my"
          },
          {
              name: "dojo",
              location: "lib/dojo"
          },
          {
              name: "dijit",
              location: "lib/dijit"
          },
          {
              name: "dojox",
              location: "lib/dojox"
          },
          {
              name: "dstore",
              location: "lib/dstore"
          },
          {
              name: "dgrid",
              location: "lib/dgrid"
          },
          {
              name: "esri",
              location: "lib/esri"
          },
          {
              name: "moment",
              location: "lib/moment",
              main: "moment",
              trees: [
                  // don"t bother with .hidden, tests, min, src, and templates
                  [".", ".", /(\/\.)|(~$)|(test|txt|src|min|templates)/]
              ],
              resourceTags: {
                  amd: function (filename, mid) {
                      return /\.js$/.test(filename);
                  }
              }
          }
  
      ],
  
      // Any module in an application can be converted into a "layer" module, which consists of the original module +
      // additional dependencies built into the same file. Using layers allows applications to reduce the number of HTTP
      // requests by combining all JavaScript into a single file.
      layers: {
          // This is the main loader module. It is a little special because it is treated like an AMD module even though
          // it is actually just plain JavaScript. There is some extra magic in the build system specifically for this
          // module ID.
          "dojo/dojo": {
              // By default, the build system will try to include `dojo/main` in the built `dojo/dojo` layer, which adds
              // a bunch of stuff we do not want or need. We want the initial script load to be as small and quick to
              // load as possible, so we configure it as a custom, bootable base.
              boot: true,
              customBase: true,
              include: [
                  "dojo/domReady",
  
                  /** enforce some modules loading */
                  /** not included because dom is -1 */
                  "dojo/_base/browser",
                  "esri/core/request/script",
  
                  // esri stuff for 3D maps
                  "esri/portal/support/layersCreator",
                  "esri/views/3d/layers/VectorTileLayerView3D"
              ]
              // You can define the locale for your application if you like
              // includeLocales: ["en-us"]
          },
          "esri/identity/IdentityManager": {
              include: [
                  "esri/identity/IdentityManager"
              ]
          },
          "esri/views/MapView": {
              include: [
                  "esri/views/MapView",
                  "esri/views/2d/layers/GraphicsLayerView2D",
                  "esri/views/2d/layers/FeatureLayerView2D",
                  "esri/views/2d/layers/TiledLayerView2D"
              ],
              exclude: [
                  "esri/widgets/support/widget"
              ]
          },
          "esri/views/SceneView": {
              include: [
                  "esri/views/SceneView",
                  "esri/layers/graphics/controllers/I3SOnDemandController",
                  "esri/layers/SceneLayer",
                  "esri/views/3d/layers/ElevationLayerView3D",
                  "esri/views/3d/layers/FeatureLayerView3D",
                  "esri/views/3d/layers/SceneLayerView3D",
                  "esri/views/3d/layers/TiledLayerView3D"
              ],
              exclude: [
                  "esri/widgets/support/widget"
              ]
          },
          "esri/WebMap": {
              include: [
                  "esri/WebMap"
              ]
          },
          "esri/WebScene": {
              include: [
                  "esri/WebScene"
              ]
          },
          "esri/layers/VectorTileLayer": {
              include: [
                  "esri/layers/VectorTileLayer"
              ]
          },
          "esri/views/2d/layers/VectorTileLayerView2D": {
              include: [
                  "esri/views/2d/layers/VectorTileLayerView2D"
              ],
              exclude: ["esri/views/MapView"]
          },
          "esri/views/2d/layers/support/FeatureLayerView2DWebGL": {
              include: [
                  "esri/views/2d/layers/support/FeatureLayerView2DWebGL"
              ],
              exclude: ["esri/views/MapView"]
          },
          "esri/core/workers/WorkerConnection": {
              include: [
                  "esri/core/workers/WorkerConnection"
              ]
          },
          "esri/views/vectorTiles/WorkerTileHandler": {
              include: [
                  "esri/views/vectorTiles/WorkerTileHandler"
              ]
          },
          "esri/widgets/support/widget": {
              include: [
                  "esri/widgets/support/widget"
              ]
          }
      }
  </code></pre>
  
  <p>I just can't figure out why! I have tried 10thteen variations. I have not tried to copy the "my" directory back to its proper location, as I shouldn't have to!! If I can't figure it out and manual copying does work, I will just add a copy after the dojo build in the process. BTW-Using NPM and grunt.</p>
  
  <p>Any ideas? Your time and expertise are greatly appreciated!!</p>
  
  <p>Cheers!</p>
  
  <p>BTW-Using NPM and grunt.
  <strong><em>EDIT: Here is the grunt stuff used to run the custom build.</em></strong> </p>
  
  <blockquote>
    <p>A quick note on the custom build. I was trying to "bake" a default
    profile into the build by defining a "defaultConfig in the build
    profile, as it didn't seem to be working. So I hardwired the
    dojoConfig as illustrated above. See the Application Build Profile
    section of:
    <a href="https://dojotoolkit.org/documentation/tutorials/1.10/build/index.html" rel="nofollow noreferrer">https://dojotoolkit.org/documentation/tutorials/1.10/build/index.html</a></p>
  </blockquote>
  
  <p>So the contents of my grunt file that matter:</p>
  
  <pre><code>module.exports = function (grunt) {
      grunt.initConfig({
          pkg: grunt.file.readJSON('package.json'),
          clean: {
              options: {
                  force: true
              },
              any: {
                  src: ''
              }
          },
          dojo: {
              dist: {
                  options: {
                      releaseDir: '../dist/js/lib',
                  }
              },
              options: {
                  profile: 'site.profile.js',
                  dojo: './js/lib/dojo/dojo.js',
                  load: 'build',
                  cwd: './',
                  basePath: './js/'
              }
          }
      });
  
      require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
      require('time-grunt')(grunt);
      grunt.registerTask('none', function () { });
      grunt.registerTask('default', 'dist');
  
      grunt.registerTask('my-dojo', function () {
          grunt.config('clean.any.src', ['./dist/js/lib']);
          grunt.task.run('clean:any');
          grunt.task.run('dojo');
          grunt.config('clean.any.src', ['./dist/js/lib/**/*.uncompressed.js']);
          grunt.task.run('clean:any');
      });
  };
  </code></pre>
  
  <p>As mentioned it copies everything to the releaseDir, including "my", where it should end up in ./dist/js. </p>