RequireJS does not include required objects

81 Views Asked by At

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?

1

There are 1 best solutions below

0
Tobias Otte On BEST ANSWER

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.