title: Building dojo app: layer downloads but not load
body: <p>I'm trying to built a Dojo app using the building system it provides. I have a main index.php file loading the dojo, dijit and dojox libraries</p>
  
  <p>The structure of the project is something like:</p>
  
  <pre>
  --root
    --_profile
    --_release
    --dojo-1.3.2-src
      -- dijit
      -- dojo
      -- dojox
      -- util
    --myApp
      --init.js
      --folders_with_all_my_code
    --index.php
  </pre>
  
  <p>In the _profile folder I have my myApp.profile.js including this:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>dependencies = {
  
      stripConsole    : 'all',
      action      : 'clean,release',
      optimize    : 'shrinksafe',
      releaseName : 'myApp',
      localeList  : 'fr,es,it',
  
      layers: [
          {
              name        : "../app/init.js",
              resourceName    : "myApp.init",
              dependencies    : [
                    "myApp.init"
              ]
          }
      ],
  
      prefixes: [
          [ "dijit",  "../dijit" ], 
          [ "dojox",  "../dojox" ],
          [ "app",    "../../app" ]
      ]
  
  };
  </code></pre>
  
  <p>I'm launching this script to build up the application:</p>
  
  <pre class="lang-sh prettyprint-override"><code>cd ../dojo-1.3.2-src/util/buildscripts
  
  ./build.bat profileFile=../../../_profile/myApp.profile.js releaseDir=../../../_release
  </code></pre>
  
  <p>It builds ok and set the _release dir as expected:</p>
  
  <pre>
  --root
    --_profile
    --_release
      -- myapp
         -- app
            -- all_my_code
            -- nls
            -- init.js.uncompressed.js
            -- init.js (a 2Mb file with all compressed dependencies)
         -- dijit
         -- dojo
         -- dojox
         -- util
    --dojo-1.3.2-src
      -- dijit
      -- dojo
      -- dojox
      -- util
    --myApp
      --
    --index.php
  </pre>
  
  <p>In the index.php file, before building I include this:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>var djConfig = {
      parseOnLoad: true, 
      usePlainJson: true,
      modulePaths : { 'app' : '../../myApp/app' }
  };
  
  script ... src="/dojo-1.3.2-src/dojo/dojo.js"&gt; ... /script
  script ... dojo.require('app.init'); ... /script
  </code></pre>
  
  <p>and works fine. But once I have my layers compiled I'm supposed to change the script pointing to dojo.js to point the newly created one and to point the dojo.require to the new compressed layer. Since in the profile I've specified than the location of the layer is the same as the original init,js file, I get this:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>var djConfig = {
      parseOnLoad: true, 
      usePlainJson: true,
      &lt;s&gt;modulePaths : { 'app' : '../../myApp/app' }&lt;/s&gt;
  };
  
  &lt;s&gt;script ... src="/dojo-1.3.2-src/dojo/dojo.js"&gt; ... /script&lt;/s&gt;
  &lt;s&gt;script ... dojo.require('app.init'); ... /script&lt;/s&gt;
  
  script ... src="/_release/myApp/dojo/dojo.js"&gt; ... /script
  script ... dojo.require('app.init'); ... /script
  </code></pre>
  
  <p>Actually when I launch the app it loads correctly just ONE file so I guess everything went OK with the paths. Actually in the Firebug log I can see the GET request and if I expand it I can see all the app compressed. However just after loading it it launch an exception:</p>
  
  <pre><code>Could not load 'app.init'; last tried '../../myApp/app/init.js'
  </code></pre>
  
  <p>I'm not sure but it doesn't seems to be a problem with the paths, since it's downloading the file init.js, so now I'm a bit confused.</p>
  
  <p>Any idea?</p>
  
  <p>Thanks!</p>