0

为了结合使用 dojo 1.8 和 1.6,我设置了可移植模块,如教程定义模块中所述,在子标题“使用可移植模块”下。

我一直将它与dojo的源版本“dojo-release-1.8.3-src.zip”一起使用,它工作得很好,但是当我切换到预构建版本时,“dojo-release-1.8 .3.zip”,它会抛出 404 错误寻找依赖项:

GET http://localhost:8080/sb/javascript/lib/dojo-release-1.8.3/dojo/parser.js     200 OK
GET http://localhost:8080/sb/javascript/lib/dojo-build-1.6.1/dojo/_base/url.js    404 Not Found
"NetworkError: 404 Not Found - http://localhost:8080/sb/javascript/lib/dojo-build-1.6.1/dojo/_base/url.js"

GET http://localhost:8080/sb/javascript/lib/dojo-release-1.8.3/dojo/request.js    200 OK
GET http://localhost:8080/sb/javascript/lib/dojo-build-1.6.1/dojo/request/default.js     404 Not Found
"NetworkError: 404 Not Found - http://localhost:8080/sb/javascript/lib/dojo-build-1.6.1/dojo/request/default.js"

从控制台很明显,它在错误的位置查找依赖文件(查找“dojo-build-1.6.1”而不是“dojo-release-1.8.3”)。我想知道为什么?我所做的只是将源版本换成预建版本。

这是我的配置:

<script>
    var map18 = {dojo: "dojo18", dijit: "dijit18", dojox: "dojo18"};
    var dojoConfig = {
        async: false,
        parseOnLoad: true,  // in 1.8 they suggest setting to false and manually parsing when needed, but we're not set up that way at the moment
        packages: [
            {name: "dgrid", location: "../../dgrid/dgrid", packageMap: map18},
            {name: "xstyle", location: "../../dgrid/xstyle", packageMap: map18},
            {name: "put-selector", location: "../../dgrid/put-selector", packageMap: map18},
            {name: "modules", location: "../../modules", packageMap: map18},
            {name: "page", location: "../../page"},
            {name: "dojoc", location: "../../dojoc"},
            {name: "dojo18", location: "../../dojo-release-1.8.3/dojo", packageMap: map18},
            {name: "dijit18", location: "../../dojo-release-1.8.3/dijit", packageMap: map18},
            {name: "dojox18", location: "../../dojo-release-1.8.3/dojox", packageMap: map18},
            {name: "dojo", location: "../../dojo-build-1.6.1/dojo", main: "dojo"},
            {name: "dijit", location: "../../dojo-build-1.6.1/dijit"},
            {name: "dojox", location: "../../dojo-build-1.6.1/dojox"}
        ],
    };
</script> 
4

1 回答 1

0

我尝试了类似的东西(同时使用 1.8 和 1.6 源)并得到了不同的错误。我知道这不是问题的答案,但我会将其粘贴在这里,以防它帮助您找到答案。

这是我的测试页面:

<script>
var location18 = "/dojo18";
var location16 = "/dojo16";
var map16 = { dojo: "dojo16", dijit: "dijit16", dojox: "dojox16" },
    dojoConfig = {
        packages: [
            { name: "dojo16", location: location16 + "/dojo", packageMap: map16 },
            { name: "dijit16", location: location16 + "/dijit", packageMap: map16 },
            { name: "dojox16", location: location16 + "/dojox", packageMap: map16 },
            { name: "dojo", location: location18 + "/dojo" },
            { name: "dijit", location: location18 + "/dijit" },
            { name: "dojox", location: location18 + "/dojox" }
        ]
    };
</script>
<script src="/dojo18/dojo/dojo.js"></script>
<script>
require(["dojo/date"], function (date) {
    console.log("date18", date);
});
</script>
<script>
require(["dojo16/date"], function (date) {
    console.log("date16", date);
});
</script>

我得到的错误似乎与加载两个日期模块有关。不确定 Dojo 是否可以单独对待它们,但我没有设法做到这一点。

错误

于 2013-04-13T21:07:51.417 回答