Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#16949 closed defect (invalid)

Require never returns if two module paths reference same URL

Reported by: neville1355 Owned by: Rawld Gill
Priority: low Milestone: tbd
Component: Loader Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:


Our dojo config is configured to have shortcut aliases to heavily re-used modules.

For example: "Long/Path/To/My/Module?"

is shortened to: "My/Module?"

This has worked fine for us up until recently when we are starting to build out very complex UI's that require several submodules.

I discovered that some require statements were never returning if "Long/Path/To/My/Module?" and "My/Module?" are required at the same time. It looks like only one of the "mids" ever gets returned since they share the same url.

In the short term, we've removed our shortcut aliasing across our application. However, having these shortcuts is a significant productivity aid and removing them has caused much chagrin with our developers.

I've attached a test case when I verified recreates the issue.

Attachments (1)

requirebug.html (1.7 KB) - added by neville1355 9 years ago.

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by neville1355

Attachment: requirebug.html added

comment:1 Changed 9 years ago by ben hockey

Owner: set to neville1355
Status: newpending

comment:2 Changed 9 years ago by neville1355

Status: pendingnew

I didn't try this. However, it doesn't look like it will work for us (at least not in my tests).

From what I see, "aliases" works on a per module basis. What we want is a alias for a whole folder of modules.

i.e. this will work,

aliases: [

['form/Button','dijit/form/Button'], ['altForm/Button','dijit/form/Button']


However, what we want is something more like this:

aliases: [

['form', 'dijit/form'], ['altForm','dijit/form']


comment:3 Changed 9 years ago by bill

Component: GeneralLoader

comment:4 Changed 9 years ago by bill

Owner: changed from neville1355 to Rawld Gill
Status: newassigned

comment:5 Changed 9 years ago by Rawld Gill

Priority: undecidedlow

I'll take a look at this as it's possible your report points to a real bug.

In the meantime, the best way to solve the problem you state is with aliases. Please have a look here:

comment:6 Changed 9 years ago by Rawld Gill

Resolution: invalid
Status: assignedclosed

The example config you provided is not rational. It tries to alias package modules via path configs, which is neither legal nor the intent of the paths machinery.

But rather than diving into subtle AMD details, use aliases for this purpose and you will be happy.

comment:7 Changed 9 years ago by neville1355

Dojo aliasing only support aliasing on a per-module basis and not aliasing folders, right?

What we would like to have is to alias a deeply nested subfolder to a top-level shortcut.






We want to be able to do this without creating an alias for every single module in the folder as that isn't scalable.


 aliases: ['Shortcut', 'Long/Path/To/My']

From what I see this isn't supported.

Note: See TracTickets for help on using tickets.