Jquery mobile 要求JS 2.1.11+;jquery mobile 1.4.2抛出错误

Jquery mobile 要求JS 2.1.11+;jquery mobile 1.4.2抛出错误,jquery-mobile,requirejs,Jquery Mobile,Requirejs,看来requireJS不能与jquery mobile 1.4.2一起正常工作 在app.js中,我有RequireJS 2.1.11的最低配置 requirejs.config({ 'baseUrl': 'js', 'paths': { 'jquery': 'lib/jquery-1.10.2', 'jquerymobile': 'lib/jquery_mobile/jquery.mobile-1.4.2' } }); 当我尝试使用jq

看来requireJS不能与jquery mobile 1.4.2一起正常工作

在app.js中,我有RequireJS 2.1.11的最低配置

requirejs.config({
    'baseUrl': 'js',
    'paths': {
        'jquery': 'lib/jquery-1.10.2',
        'jquerymobile': 'lib/jquery_mobile/jquery.mobile-1.4.2'
    }
});
当我尝试使用jquerymobile依赖性时,我有:

define(['require', 'jquery', 'jquerymobile' ], function (require, $) {
   console.log(success)
})
这显示了Chrome控制台中的错误

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/app/www/js/demos/js/jquery.js
Uncaught Error: Script error for: demos/js/jquery
http://requirejs.org/docs/errors.html#scripterror require.js:141
这是由jquery移动代码引起的:

(function ( root, doc, factory ) {
    if ( typeof define === "function" && define.amd ) {
        // AMD. Register as an anonymous module.
        define( [ "demos/js/jquery" ], function ( $ ) {
            factory( $, root, doc );
            return $.mobile;
        });
    } else {
        // Browser globals
        factory( root.jQuery, root, doc );
    }
}

当我使用jquerymobile1.3.2进行更改时,似乎requirejs工作正常。有没有办法在Jquery mobile 1.4.2中使用requireJS?

您使用的源代码不正确。当我径直走到街上时,我看到:

这正是我所期望的:jquerymobile依赖于
jQuery
,这是您总是需要jQuery和RequireJS的方式


您在问题中显示的代码中看到的
demos/js/jquery
依赖关系没有多大意义。这是可能的,但它需要每个使用jQuery Mobile的人都经历一个不必要的配置过程。这是一个很大的危险信号,表明出了问题。

thx正确!我复制了zip存档中demo文件夹下的JS文件,该文件引用了/demos/。
(function ( root, doc, factory ) {
    if ( typeof define === "function" && define.amd ) {
        // AMD. Register as an anonymous module.
        define( [ "jquery" ], function ( $ ) {
            factory( $, root, doc );
            return $.mobile;
        });
    } else {