cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.88k stars 216 forks source link

Module code executes again when using both shortcut and full paths #137

Closed zourtney closed 11 years ago

zourtney commented 12 years ago

I am seeing module code execute twice when I curl from both a standard path and a config-mapped 'shortcut' path. Consider the following contrived example:

In sub/folder/module.js

define([], function() {
    console.log('Executing module.js');
});

In index.html or similar

var curlConfig = {
    paths: {
        shortcut: 'sub/folder/module'
    }
};

curl(curlConfig, ['sub/folder/module', 'shortcut'], function() {
    // You will see module.js run twice
});

Result: you will see the console output twice.

Additional Notes:

Is this a dup of https://github.com/cujojs/curl/issues/110?

unscriptable commented 12 years ago

Thanks @zourtney! Definitely a bug, but not (directly) related to #110. I'm adding more tests and will issue a fix asap.