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

How to pass focus to a new field as soon as it appears (angular 1.4)?

javascript angularjs

In the following example a new field is added (by adding a blank row to $scope) when the last field loses focus if it is not empty. The problem is that the new field is not added to the DOM in time...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.