RequireJS does not include required objects

given code below:

require.config({
    baseUrl: '',
    paths: {
        'jquery'    : 'js/lib/jquery',
        'text'      : 'js/lib/text',
        'underscore'    : 'js/lib/underscore',
        'icanhaz'   : 'js/lib/ICanHaz'
    }});

require(['jquery', 'icanhaz', 'underscore', "text!view/module/login/login.html"],
function ($, ich, _,loginHtml)
{   
   //jquery has value
   //icanhaz is undefined
   //_ is undefined
   //loginHtml has value

Can you please explain to me why jQuery and text have values where other files in the same folder do not and are undefined when code executes?

Answers


Because jQuery for example has a define call which returns jQuery:

define( "jquery", [], function () { return jQuery; } );

Other libraries don't have this. You can use shim config to solve this problem.


Need Your Help

time an ajax request

javascript ajax jquery

Is there any way to time how long a jquery ajax request has been going on? sometimes searches take too long and it would be nice to add a jquery abort() button if the search takes over, say, 5 seco...

C - split/store string of X length into an array of structs

c string pointers struct

I'm trying to split a string every X amount of characters, and then store each line in an array of structs. However, I'm wondering what would be a short and efficient way of doing it. I thought that