我正在尝试从旧的 dojo 构建系统切换到新的系统。我一直在拔头发,但似乎无法让构建脚本获取我在构建配置文件中指定的自定义路径映射。所以如果我的项目结构是这样的:
/www/dojo
/www/dojox
/www/dijit
/www/app.profile.js
/www/myapp/package.json #links to myapp.profile.js
/www/myapp/myapp.profile.js #standard package profile stub
#with test,copyOnly,amd
/www/myapp/main.js
/www/myapp/bar/hello.js
/www/myapp/bar/sometext.html
文件如下所示:
//-------------------------------------------
//FILE: app.profile.js
//-------------------------------------------
var profile = (function(){
return {
basePath: ".",
releaseDir: "builds",
releaseName: "v0_0_1",
optimize: "closure",
cssOptimize: "comments",
action: "release",
packages:[
{
name: "dojo",
location: "dojo/dojo"
},
{
name: "myapp",
location: "myapp"
}
],
prefixes: {
"foo": "bar" //doesn't seem to work?
},
paths: {
"foo": "bar" //doesn't seem to work?
},
loaderConfig:{
paths: {
"foo": "bar" //doesn't seem to work?
},
},
layers: {
"mypp/myapp-release": {
include: [
"myapp/main"
]
}
}
};
})();
//--------------------------------------
//FILE: main.js
//--------------------------------------
require(["dojo/_base/html", "foo/hello", "dojo/text!foo/sometext.html"],
function(html, Bar, sometext){
alert(sometext);
}
);
//--------------------------------------
//FILE: hello.js
//--------------------------------------
require([ ],
function(){
alert("hello!");
}
);
我正在运行构建命令:
node /www/dojo/dojo.js load=build /www/app.profile.js
构建脚本会告诉我没有找到依赖项“foo/hello”,即使它应该映射到 bar/hello.js ;foo/sometext.html 也是如此。
任何帮助将非常感激; 我不想一直拉头发直到我秃顶!:D