5

My question, while at first somewhat similar to this one, seems to be a more basic question - and might be signaling a bug in the build system. I've created a custom build for my dojo application. I only build one layer right now, here's what the profile script/object looks like:

dependencies = {
    stripConsole: "all",
    action: "release",
    optimize: "shrinksafe",
    releaseName: "myProject",
    // list of locales we want to expose
    localeList: "en-gb,en-us,de-de",

    layers: [
        {
            // Name: a relative path from the dojo.js in the desination directory.
            name: "../../myProject.js",
            dependencies: [
                "myPackage.MyDataStore",
                // MyWidget depends on a few other widgets, and has its own 
                //   translation files.
                "myPackage.MyWidget"
            ]
        }
    ],

    prefixes: [
        // These paths are relative to the location of dojo.js
        [ "dijit", "../dijit" ],
        [ "dojox", "../dojox" ],
        [ "myPackage", "../../../src/myPackage" ]
    ]
}

When I run a build with that description it outputs files in the following directory structure:

release/
release/myProject/
release/myProject/dijit/
                       ... dijit ...
release/myProject/dojo/
                      ... dojo ...
release/myProject/dojox/
                       ... dojox ...
release/myProject/myPackage/
                           ... my custom package ...
release/nls/
           myProject_en-us.js
           myProject_de.js
           etc..
../myproject.js
../myProject.js.uncompressed.js

Finally, in my test HTML page - I've got the following:

<script type="text/javascript">
    var djConfig = {
        debug: true,
        parseOnLoad: false,
        modulePaths: { // paths to directories in relation to dojo's location.... hurr.
            'myPackage': '../myPackage',
            'dojox':    '../dojox',
            'dijit':    '../dijit'
        }
    };
</script>
<script type="text/javascript" src="./release/myProject/dojo/dojo.js.uncompressed.js"></script>
<script type="text/javascript" src="./release/myProject.js.uncompressed.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
    dojo.require('myPackage.MyDataStore');
    dojo.require('myPackage.MyWidget');

    var store = new myPackage.MyDataStore();
    var widget = new myPackage.MyWidget({
        store: store
    }, dojo.byId('testWidget'));

    widget.startup();
});
</script>

But unfortunately, Firebug spits this out at me:

Bundle not found: MyWidget in myPackage , locale=en-us

What I Think is Happening

I've traced through some of the code leading up to the above error and it seems like the dojo.i18n._preloadLocalizations() call at the end of the file doesn't actually load in the correct nls file from ./release/nls.

Any idea how to fix this without resorting to manually including the nls files with <script> tags?

Community
  • 1
  • 1
JasonWyatt
  • 5,275
  • 1
  • 31
  • 39
  • I've run into similar problems. It's not clear to me if there is a problem in the build system or the loader. I did determine that if I named my layer file to be in the same directory as dojo.js (that is, make it "name: 'myProject.js'") and adjust the script tag to use this path (./release/myProject/dojo/myProject.js.uncompressed.js), then the loader pulls in the correct nls files. – tommyjr Jan 13 '11 at 18:38
  • I'm guessing that this has to do with your modulePaths in the djConfig object. If you look at firebug or similar, what URL is the app trying to load the nls from vs where should it be loading it from? –  Aug 15 '11 at 13:55

1 Answers1

4

It's a bug of dojo, you should not use '..' in your layers name in case it will generate a NLS package.

please refer to http://bugs.dojotoolkit.org/ticket/5225

hbaaron
  • 56
  • 2