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: http://blog.rebeccamurphey.com/scaffolding-a-buildable-dojo-application

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                 build.sh                 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';         this.author = config.author || 'Unknown';     } }); var myapp = new MyApp({     author: 'Mark McDonnell' }); alert(myapp.author); 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 build.sh' and the build.sh file within the /Classes/ directory consists of the following code...

cd ../../../dojo-sdk/util/buildscripts ./build.sh profileFile=../../../Assets/Scripts/Classes/Profile.js releaseDir=../../../Assets/Scripts/Release

...now, 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 :-)

Thanks!

M.

Answers


I'd suggest working from the repo I linked to from my blog post (http://github.com/rmurphey/dojo-scaffold) -- 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 asp.net asp.net-mvc

Im a beginner programming in asp.net. 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