为了结合使用 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>