我有一个 Mediator-Sandbox 库和一个构建在这个库之上的路由器扩展。
该库是这样构建的:
(function(window) {
var MedSan = {};
window.MedSan = MedSan;
})(this);
扩展看起来像这样:
(function(_, Backbone, MedSan) {
MedSan.Router = {};
})(_, Backbone, MedSan);
加载扩展所需的配置如下所示:
require.config({
baseUrl: "javascripts",
shim: {
"jquery": {
exports: "$"
},
"underscore": {
exports: "_"
},
"backbone": {
deps: ['jquery', 'underscore'],
exports: "Backbone"
},
"Distribution": {
exports: "Distribution"
},
"Distribution.Router": {
deps: ['underscore', 'backbone', 'Distribution'],
exports: "Distribution"
}
},
/*
map: {
"*": {
"Distribution": "Distribution.Router"
}
},
*/
paths: {
"jquery": "Vendors/jquery",
"underscore": "Vendors/underscore",
"backbone": "Vendors/backbone",
"Distribution": "Distribution/Distribution",
"Distribution.Router": "Distribution/Plugins/Router"
}
});
我现在可以使用我的完整库:
require(['Distribution.Router'], function(Distribution) {});
当我取消注释地图配置时,我可以通过这种方式使用带有路由器扩展的完整加载模块:
require(['Distribution'], function(Distribution) {});
比我得到一个模块超时。
我究竟做错了什么?