Opened 8 years ago

Closed 8 years ago

#13559 closed defect (invalid)

aliases config property breaks with plugins

Reported by: ben hockey Owned by: Rawld Gill
Priority: high Milestone: 1.7
Component: Loader Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

the attached test case contains the following:

// configure dojo
dojoConfig = {
        async: 1,
        aliases: [
                [/^myDojo/, 'dojo']
        ],
        deps: ['myDojo'],
        callback: function (d) {
                console.log('dojo loaded');
                require(['myDojo/domReady!'], function () {
                        console.log('dom ready');
                });
        }
};

if i change 'myDojo/domReady!' to 'myDojo/domReady' then i'll see the 2nd log.

Attachments (1)

13559.html (462 bytes) - added by ben hockey 8 years ago.

Download all attachments as: .zip

Change History (2)

Changed 8 years ago by ben hockey

Attachment: 13559.html added

comment:1 Changed 8 years ago by Rawld Gill

Resolution: invalid
Status: newclosed

The alias given above will map all modules that begin with "myDojo" to the single module "dojo" which implies "dojo/main". And dojo/main is not a plugin.

You could get the code to work as you intend by changing the aliases config to look like this:

aliases: [
	["myDojo", "dojo/main"],
	["myDojo/domReady", "dojo/domReady"]
],

But, I'm not sure I see how this is useful.

The intent of allowing a regex is to help map a set of modules to the same module. For example,

aliases:[[/\/text$/, "dojo/text"]]

would map require/text and someOtherPackage/text to the dojo text module.

Thinking about it (this is the second time the regex has generated a question), the regex form may be more trouble than it's worth.

Note: See TracTickets for help on using tickets.