Problem using Dojo build tool, 'could not load' error now occuring when trying to use compiled scripts

I was following along to this post by Rebecca Murphey:

I was substituting her file structure with my own.

Running the normal version of the scripts works fine, but the moment I compile them using the build tool, the script errors.

It's very likely a small problem with how the files are referenced via my Profile.js script but maybe someone here can help me get the settings correct before running the build tool so the compiled files will work as they should.

My file structure is as follows...

/www     /Assets         /Scripts             /Classes                        Init.js                 Load.js                 Profile.js             /Dojo                 Dojo.js     /dojo-sdk     index.html

My index.html file has the following code...

<script>     var djConfig = {         modulePaths : {             'Integralist' : '../Classes'         }     }; </script> <script src="Assets/Scripts/Dojo/Dojo.js"></script> <script>     dojo.require('Integralist.Init'); </script>

...and the Init.js file has the following code...

dojo.provide('Integralist.Init'); dojo.require('Integralist.Load'); dojo.declare('MyApp', null, {     constructor: function(config) {         this.version = config.version || '1.0'; = || 'Unknown';     } }); var myapp = new MyApp({     author: 'Mark McDonnell' }); alert(; alert(myapp.version);

...lastly, the Load.js file has nothing in it but this...

dojo.provide('Integralist.Load'); alert('I\'m the Load.js file');

...and this all runs fine. When I load index.html I get 3 alert messages, brilliant.

The problem occurs when I try to run the build tool.

Via Mac OSX i locate the /Classes/ directory and run 'sh' and the file within the /Classes/ directory consists of the following code...

cd ../../../dojo-sdk/util/buildscripts ./ profileFile=../../../Assets/Scripts/Classes/Profile.js releaseDir=../../../Assets/Scripts/Release, after running the build tool I have a new /Release/ directory created within my /Scripts/ directory, this /Release/ directory consists of...

/www     /Assets         /Scripts             /Release                 /Integralist                     /Classes                         Init.js                         Init.js.uncompressed.js                     /dojo                         --loads of dojo related files--

...I then created a separate index file called index-release-version.html and changed the script code as suggested by the article, so it looks like this...

<script src="Assets/Scripts/Release/Integralist/dojo/dojo.js"></script> <script>     dojo.require('Integralist.Init'); </script>

...from here I get the following error...

Failed to load resource: the server responded with a status of 404 (Not Found) Uncaught Error: Could not load 'Integralist.Init'; last tried '../Integralist/Init.js'

...and just for reference my Profile.js file that is used by the build tool consists of the following (and it's here I think the problem may be)...

dependencies = {     stripConsole : 'all',     action : 'clean,release',     optimize : 'shrinksafe',     releaseName : 'Integralist',     localeList : 'en-gb',

    layers: [         {             name: "../Classes/Init.js",             resourceName : "Integralist.Init",             dependencies: [                 "Integralist.Init"             ]         }     ],

    prefixes: [         [ "Integralist", "../Classes" ]     ] }

Any help really appreciated as I desperately want to get my head around how Dojo works :-)




I'd suggest working from the repo I linked to from my blog post ( -- I double-checked that it's definitely working :) -- and make changes to it until your changes break something, rather than trying to create your own structure right off the bat.

At a glance, I'm not 100% clear why you've got a Dojo.js file inside your directory structure, (is this the base Dojo lib or something else?), but the rest of Dojo is located elsewhere. If you use the structure I proposed, you can safely remove the djConfig declaration when using the built files, but as Dan mentioned, you may need to keep it if you're using a different configuration.

Do you have that djConfig variable in your index-release-version.html? It looks like Dojo is trying to find init.js at ../Integralist/Init.js, but you somehow need to tell it to look in ../Classes/Init.js

This is what your modulePaths : {'Integralist' : '../Classes'} was doing in your Index.html

Need Your Help

How to Create default password in ASP.NET Identity

c# mysql

Im a beginner programming in I have mysql integration for the identity in ASP.NET with this powerful tutorial...

Confidence interval bands in ggplot2 when using stat_quantile?

r ggplot2 smoothing quantile quantreg

I would like to add the median spline and corresponding confidence interval bands to a ggplot2 scatter plot. I am using the 'quantreg'-package, more specifically the rqss function (Additive Quantile