Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#8783 closed defect (invalid)

Renaming dojo.js causes dojo_en-us.js to not be found.

Reported by: Scott Owned by: James Burke
Priority: high Milestone: tbd
Component: Loader Version: 1.3.0b2
Keywords: Cc:
Blocked By: Blocking:


Reference works as expected:

<script type="text/javascript" src="/_js/dojo.js" djConfig="parseOnLoad:true,
 locale: 'en-us', baseUrl:'/_js/dojo/dojo/'"></script>

But renaming dojo.js to something else causes an error in Firebug:

<script type="text/javascript" src="/_js/what.js" djConfig="parseOnLoad:true,
 locale: 'en-us', baseUrl:'/_js/dojo/dojo/'"></script>

The error is below. Note that http://localhost/test/ is where I'm calling the page from.

GET http://localhost/test/undefined./nls/dojo_en-us.js404 (17ms)

I couldn't find anything that explicitly says renaming dojo.js is supported, but there are comments in the forums that imply this should work, so I'm wondering if there's a place in the i18n code where there's an accidental hard coding of a parameter that shouldn't be there.

BTW, this might seem like a trivial issue, but I have a requirement that my page only call one specific javascript file (that isn't named dojo.js), so this is the only way I know to make it work.

Change History (8)

comment:1 Changed 10 years ago by Adam Peller

I'm fairly certain this is not intended to work. The following code in the bootstrap assumes "dojo" as the filename.

			var rePkg = /dojo(\.xd)?\.js(\W|$)/i;

comment:2 Changed 10 years ago by Scott

If you or someone else is comfortable that this is the intent, feel free to close the bug as won't fix. I saw comments from jburke and others in the forums from a few months ago saying it should work which is why I raised the issue in the first place.

The work-around in my particular case is to load dojo from the fixed .js file using the afterOnLoad parameter.

comment:3 Changed 10 years ago by Eugene Lazutkin

Component: GeneralInternationalization
Owner: changed from anonymous to James Burke

comment:4 Changed 10 years ago by dante

peller is right, we use 'dojo' in the regexp to determine the script elem that _might_ have the djConfig.

dojo.js can be named whatever provided you are able to define your djConfig before that script tag:

<script>var djConfig={ parseOnLoad:true }</script>
<script src=""></script> 

works perfectly. The regexp is only determining djConfig as far as I know (maybe baseurl too?)

Probably can mark this as invalid, but maybe there is a non-regexp way for dojo.js to know the element it is but whatever that may be it would be an enhancement. The current behavior is expected, though imho less than ideal.

comment:5 Changed 10 years ago by Adam Peller

yes, baseurl is also configured from that regexp and, afaict, the entire loader hinges off that. The i18n is using the same path as dojo.require, it just happens to be the first thing to get loaded in some scenarios.

comment:6 Changed 10 years ago by Adam Peller

Component: InternationalizationPackageSystem

comment:7 Changed 10 years ago by James Burke

Resolution: invalid
Status: newclosed

Closing as working as designed. You can name the file something other than dojo but then need to provide djConfig as a JavaScript? object before the script that that loads dojo. There is also a build option, scopeDjConfig, that allows you to burn in a djConfig inside the file.

comment:8 Changed 8 years ago by feklee

Unfortunately the current behavior makes it impossible to have baseUrl automatically detected if dojo.js is renamed. And renaming dojo.js is necessary if one wants to have a build with the Dojo layer and an application specific layer in one file.

I know that one can specify baseUrl using dojoConfig/djConfig. However that is not user friendly, for example when offering inclusion of the script to third parties who don't want to be bothered about technical details. And scopeDjConfig will be of no help if the base path is not known at build time.

So I vote for an option that allows it to manually specify the rePkg regular expression using dojoConfig. Or some more elegant solution.

Note: See TracTickets for help on using tickets.