Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#2776 closed defect (wontfix)

dojo's value in _modulePrefixes -- _base doesn't load if directory is not named "dojo"

Reported by: guest Owned by: anonymous
Priority: high Milestone:
Component: Core Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

I ran into troubles loading the 0.9 trunk. I think others may have had similar problems and I thought I'd bring it up.

I started development in the 0.9 trunk code by syncing to the svn uri http://svn.dojotoolkit.org/dojo/dojo/trunk . I put this in a local directory at /www/js/dojo_0_9_trunk. However, it seems that dojo won't load unless the parent directory is named "dojo" exactly. After looking into it, here is what I've found:

The loader sets up module prefixes in _base/_loader/loader.js like so:

_modulePrefixes: {

dojo: {name: "dojo", value: ""}, tests: {name: "tests", value: "tests"}

},

The value for dojo is an empty string.

When calling dojo.require, for instance dojo.require("dojo._base.lang"), the _loadModule function calls _getModuleSymbols to get an array of symbols where the module is located. The dojo module should obviously be located in the same directory as dojo.js. However, when testing for the module prefix, this._moduleHasPrefix("dojo") returns false, because the value for dojo is an empty string and ("" == false).

The result is that the module location for "dojo._base.lang" becomes "../dojo/_base/lang.js". This path is ONLY correct if the directory containing dojo.js is named "dojo". If it is named "trunk", or "dojo09", or "dojo-0-9-ajax", or anything else, then the module can not be found.

In version 0.4.2, dojo's module prefix value was "src". In 0.9, I can resolve the problem by setting dojo's module prefix value to "./", like this: (loader.js)

_modulePrefixes: {

dojo: {name: "dojo", value: "./"}, tests: {name: "tests", value: "tests"}

},

To solve some subversion issues, Jared J was kind enough to refer me to the following svn uri: http://svn.dojotoolkit.org/dojo/view/anon/all/trunk which I will begin using immediately. However, it seems that the dojo core should not be dependent on the name of the directory that contains it.

~msmith

Change History (2)

comment:1 Changed 12 years ago by guest

By the way, I've submitted a CLA, but don't have a trac login yet. ~Michael Smith (msmith)

comment:2 Changed 12 years ago by Adam Peller

Resolution: wontfix
Status: newclosed

Mike, I think this is by design. We chose to do it this way because being flexible turned out to be too expensive.

Note: See TracTickets for help on using tickets.