我正在尝试为我的项目创建一个图层。我希望该图层包含
myProject/controllers/MainApp
及其myProject
中的所有依赖项
包。我不想在我的图层中包含任何dojo,dijit或otherPackages。
这是我到目前为止所做的:
var profile = (function() {
var locationPrefix = "something";
return {
basePath: "../src",
releaseDir: "../dojoRelease",
releaseName: "lib",
action: "release",
packages: [
{
name: 'dojo',
location: locationPrefix + '/dojo/dojo'
}, {
name: 'dijit',
location: locationPrefix + '/dojo/dijit'
}, {
...
}, {
name: 'myProject',
location: 'myProject',
destLocation: 'myProject'
}
],
layers: {
"myProject": {
include: ["myProject/controllers/MainApp"],
// QUESTION: How can I use exclude to not include all dojo modules?
// tried several things but none seem to work. Can't find any doc
// on what exclude takes as input.
// exclude: ["dojo/dojo"],
boot: false,
customBase: true
}
}
};
})();
问题在于,当我查看我的main.js.uncompressed.js时,它会包含许多不是
在myProject
。这些是main.js.uncompressed.js文件中的前几行:
require({cache:{
'dojo/parser':function(){
define([
"require", "./_base/kernel", "./_base/lang", "./_base/array", "./_base/config", "./dom", "./_base/window",
"./_base/url", "./aspect", "./promise/all", "./date/stamp", "./Deferred", "./has", "./query", "./on", "./ready"
], function(require, dojo, dlang, darray, config, dom, dwindow, _Url, aspect, all, dates, Deferred, has, query, don, ready){
// module:
// dojo/parser
new Date("X"); // workaround for #11279, new Date("") == NaN
// data-dojo-props etc. is not restricted to JSON, it can be any javascript
function myEval(text){
return eval("(" + text + ")");
}
来源:
以及许多其他文件也显示在main.js.uncompressed.js文件中。
如何将main.js.uncompressed.js文件限制为仅文件 在我的项目?谢谢!
更新:我尝试从包列表中删除dojo,dijit等。这会导致main.js.uncompressed.js生成或多或少正确生成,然后编译器会在生成缩小文件时挂起。还有很多这样的错误:
error(311) Missing dependency. module: myProject/controllers/someFile; dependency: dojo/_base/declare
error(311) Missing dependency. module: myProject/controllers/someFile; dependency: dojo/_base/lang
error(311) Missing dependency. module: myProject/controllers/someFile; dependency: dojo/Deferred
答案 0 :(得分:0)
问题在于,当我查看我的main.js.uncompressed.js时 包含许多不在myProject中的东西。
他们可能不是 in myProject但是你确定你没有在任何地方使用它们吗?例如,在输出中,您显示someFile正在使用dojo / _base / declare函数。如果你在someFile模块的开头使用declare,那么你需要在层中使用dojo才能运行它。
error(311) Missing dependency. module: myProject/controllers/someFile; dependency: dojo/_base/declare
error(311) Missing dependency. module: myProject/controllers/someFile; dependency: dojo/_base/lang
error(311) Missing dependency. module: myProject/controllers/someFile; dependency: dojo/Deferred
找不到任何排除作为输入的文档。
它的格式与include相同 - 字符串模块数组 - 请参见此处: http://dojotoolkit.org/documentation/tutorials/1.10/build/ http://dojotoolkit.org/reference-guide/1.10/build/
使用boot属性还会在你的层中包含一些dojo代码,因为你告诉构建器使你的层可以启动,所以它必须包含用于模块加载的dojo代码,以便你加载其他模块。