路径中的依赖关系-requirejs
我正在使用requireJS和ilighbox脚本。 lightbox需要4个文件才能工作。 现在我有这样的代码:路径中的依赖关系-requirejs,requirejs,Requirejs,我正在使用requireJS和ilighbox脚本。 lightbox需要4个文件才能工作。 现在我有这样的代码: require.config({ baseUrl: "/js/", paths: { jquery: "libs/jquery/jquery-1.11.1.min", jqueryAnimationFrame: "libs/ilightbox/js/jquery.requ
require.config({
baseUrl: "/js/",
paths: {
jquery: "libs/jquery/jquery-1.11.1.min",
jqueryAnimationFrame: "libs/ilightbox/js/jquery.requestAnimationFrame",
jqueryMouseWheel: "libs/ilightbox/js/jquery.mousewheel",
ilightbox:"libs/ilightbox/js/ilightbox.packed"
}
});
我可以像在shim中一样使用依赖项吗?
例:
您可以使用垫片-但它们基于包,而不是路径:
require.config({
baseUrl: '../',
paths: {
'jquery': 'lib/jquery-1.7.2',
'underscore': 'lib/underscore',
'backbone': 'lib/backbone',
'console': 'lib/console'
},
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
console: {
exports: "console"
}
}
});
我不想用垫片。我想在路径中使用依赖项
require.config({
baseUrl: '../',
paths: {
'jquery': 'lib/jquery-1.7.2',
'underscore': 'lib/underscore',
'backbone': 'lib/backbone',
'console': 'lib/console'
},
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
console: {
exports: "console"
}
}
});