我正在尝试使用RequireJS v2.3.5加载jQuery 1.12.1 Slider小部件,所以我可以使用名为“jquery.selectBoxIt”的小部件,我的设置是这样的:
文件结构:
node_modules
AOP/Scripts/app/requireconfig.js
requireconfig.js
require.config({
baseUrl: '/AOP/Scripts',
paths: {
'jquery.selectboxit': '../../node_modules/selectboxit/src/javascripts/jquery.selectBoxIt'
},
shim: {
'jquery.selectboxit': ['jquery.ui.slider']
},
packages: [{
name: 'jquery.ui.slider',
location: '../../node_modules/jquery-ui/ui/widgets',
main: 'slider'
}],
});
但我收到了这些错误:
http://dev.k2.aop.local/AOP/Scripts/keycode.js
Uncaught Error: Script error for "keycode", needed by: jquery.ui.slider/slider
GET http://dev.k2.aop.local/AOP/Scripts/widget.js
Uncaught Error: Script error for "widget", needed by: jquery.ui.slider/slider
Uncaught Error: Script error for "version", needed by: jquery.ui.slider/slider
http://dev.k2.aop.local/AOP/Scripts/version.js
Uncaught Error: Script error for "ie", needed by: jquery.ui.slider/mouse
http://dev.k2.aop.local/AOP/Scripts/ie.js
Uncaught Error: Load timeout for modules: jquery.selectboxit
我曾尝试将所有这些依赖项添加为RequireJs包,但最后会再次弹出此错误
Uncaught Error: Load timeout for modules: jquery.selectboxit,keycode/version,widget/version,ie/version