dojo/loader

Possible UMD bug

msssk opened this issue · 3 comments

I tried to load cldrjs and the module resolved to a new, empty object.

Using Dojo 1's loader it works fine.

Install 'cldrjs' with bower or npm, then require(['cldrjs/dist/cldr'], ...)

@msssk, can you provide a test file?

It turns out that this was not an issue with loading UMD modules specifically. The issue was more isolated to loading modules in an AMD environment where only a factory is defined with no dependencies. Essentially, the loader was not capturing the result of the factory's execution under that specific scenario leaving the default empty object as the modules resolution.

Loading this module would result in the same error:

define(function () {
    //...
});

The solution (along with tests) can be found in this commit jdonaghue@6b4d6a7