我的项目有以下AMD配置:
var amdconfig = {
baseUrl: __AMD_CONFIG_BASE_URL__,
packages: [
{name: "loader", location: "./samples/lib/requirejs"},
{name: "dojo", location: "./samples/lib/dojo"},
{name: "dojox", location: "./samples/lib/dojox"},
{name: "dijit", location: "./samples/lib/dijit"},
{name: "luciad", location: "./luciad"},
{name: "samples", location: "./samples"}
],
cache: {},
paths: {
jquery: "./samples/lib/jquery/jquery-1.12.4",
d3: "./samples/lib/d3/d3",
bloodhound: "./samples/lib/typeahead/bloodhound",
typeahead: "./samples/lib/typeahead/typeahead.jquery"
}
};
对于Dojo构建系统,我有以下配置:
var profile = {
basePath: __AMD_CONFIG_BASE_URL__,
releaseDir: "release",
action: "release",
stripConsole: "all",
optimize: "closure",
layerOptimize: "closure",
selectorEngine: "acme",
async: 1,
packages: [{
name: "loader",
location: "./samples/lib/requirejs",
destLocation: "./samples/lib/requirejs"
}, {
name: "dojo",
location: "./samples/lib/dojo",
destLocation: "./samples/lib/dojo"
}, {
name: "dijit",
location: "./samples/lib/dijit",
destLocation: "./samples/lib/dijit"
}, {
name: "dojox",
location: "./samples/lib/dojox",
destLocation: "./samples/lib/dojox"
}, {
name: "luciad",
location: "../../main/javascript/luciad",
destLocation: "./luciad"
}, {
name: "samples",
location: "./samples",
destLocation: "./samples"
}],
paths: {
jquery: "./samples/lib/jquery/jquery-1.12.4",
d3: "./samples/lib/d3/d3",
bloodhound: "./samples/lib/typeahead/bloodhound",
typeahead: "./samples/lib/typeahead/typeahead.jquery"
},
layers: {
"samples/lib/requirejs": {
include: [
"samples/lib/requirejs"
],
boot: true
}
}
};
不幸的是,Dojo构建系统似乎不知道如何处理这些路径:
error(311) Missing dependency. module: samples/trajectories/main; dependency: bloodhound
error(311) Missing dependency. module: samples/trajectories/TimeChart; dependency: d3
error(311) Missing dependency. module: samples/trajectories/TimeChart; dependency: jquery
error(311) Missing dependency. module: samples/trajectories/TypeaheadFilter; dependency: jquery
error(311) Missing dependency. module: samples/trajectories/TypeaheadFilter; dependency: bloodhound
error(311) Missing dependency. module: samples/trajectories/TypeaheadFilter; dependency: typeahead
我该如何解决这个问题?
我尝试使用files
属性,但我无法将其用于:
...
files: [
["jquery", "./samples/lib/jquery/jquery-1.12.4.js"],
["d3", "./samples/lib/d3/d3.js"],
["bloodhound", "./samples/lib/typeahead/bloodhound.js"],
["typeahead", "./samples/lib/typeahead/typeahead.jquery.js"]
],
...
我尝试将它们定义为包,但这也不起作用:
...
{
name: "jquery",
location: "./samples/lib/jquery",
destLocation: "./samples/lib/jquery",
main: "jquery-1.12.4"
}, {
name: "d3",
location: "./samples/lib/d3",
destLocation: "./samples/lib/d3",
main: "d3"
}, {
name: "bloodhound",
location: "./samples/lib/typeahead",
destLocation: "./samples/lib/typeahead",
main: "bloodhound"
}, {
name: "typeahead",
location: "./samples/lib/typeahead",
destLocation: "./samples/lib/typeahead",
main: "typeahead.jquery"
}
...
我错过了什么?
我正在使用dojo-util
的版本1.10.4。
答案 0 :(得分:0)
我遇到了同样的问题。 来自Dojo Build Documentation:
使用--dojoConfig命令行标志指向包含包含程序包配置数据的dojoConfig对象的脚本
目前尚不清楚,但是可以将其视为构建配置文件仅使用软件包信息,而忽略paths变量。
非常感谢,我发现了this文章,它解释了如何在构建配置文件中使用map对象,该对象的作用类似于dojoConfig中的path变量。
所以根据您的情况,如果要添加
"map": {
"*": {
"jquery": "./samples/lib/jquery/jquery-1.12.4",
"d3": "./samples/lib/d3/d3",
"bloodhound": "./samples/lib/typeahead/bloodhound",
"typeahead": "./samples/lib/typeahead/typeahead.jquery"
}
}
进入您的构建配置文件,并将路径保留在dojoConfig中,一切正常。
由于“ map”和“ paths”的配置重复,因此不确定这是否是最优雅的解决方案,因此,如果有人有更好的解决方案,请回复!