#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: |
Description
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)
Change History (8)
Changed 8 years ago by
Attachment: | requirebug.html added |
---|
comment:1 Changed 8 years ago by
Owner: | set to neville1355 |
---|---|
Status: | new → pending |
comment:2 Changed 8 years ago by
Status: | pending → new |
---|
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 8 years ago by
Component: | General → Loader |
---|
comment:4 Changed 8 years ago by
Owner: | changed from neville1355 to Rawld Gill |
---|---|
Status: | new → assigned |
comment:5 Changed 8 years ago by
Priority: | undecided → low |
---|
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: http://dojotoolkit.org/reference-guide/1.8/loader/amd.html#alias-modules
comment:6 Changed 8 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
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 8 years ago by
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.
E.g.
From:
Long/Path/To/My/Module1 Long/Path/To/My/Module2 Long/Path/To/My/Module3
To:
Shortcut/Module1 Shortcut/Module2 Shortcut/Module3
We want to be able to do this without creating an alias for every single module in the folder as that isn't scalable.
I.e.:
dojoConfig= { aliases: ['Shortcut', 'Long/Path/To/My'] }
From what I see this isn't supported.
did you try
alias
rather thanpaths
? http://dojotoolkit.org/reference-guide/1.8/loader/amd.html#alias-modules