Mvvm 为什么这款单体AMD不能使用不同的服务?

Mvvm 为什么这款单体AMD不能使用不同的服务?,mvvm,requirejs,single-page-application,durandal,Mvvm,Requirejs,Single Page Application,Durandal,在我的整个应用程序中,我都引用了一个名为hub.js的单体AMD-定义如下: // hub.js define(['services/dataservice'], function (dataservice) { // list of properties // dataservice === undefined - why? } 我从其他虚拟机中引用它,如下所示: define(['durandal/app', 'services/dataservice', 'durandal/plugin

在我的整个应用程序中,我都引用了一个名为hub.js的单体AMD-定义如下:

// hub.js
define(['services/dataservice'], function (dataservice) {
// list of properties
// dataservice === undefined - why?
}
我从其他虚拟机中引用它,如下所示:

define(['durandal/app', 'services/dataservice', 'durandal/plugins/router', 'services/hub' ], function (app, dataservice, router, hub) {
但是我需要从我的中心访问我的数据服务,正如您在第一段代码中看到的那样。尽管使用了与其他虚拟机相同的精确语法,但hub中对dataservice的引用都是未定义的

如果我使用的路径与services/dataservice不同,那么我会得到404 not found,因此JS似乎看到了该文件,但出于某种原因没有将其加载到这个单例中


发生什么事了

这是一个循环参考: