我正在尝试使用Dojo构建系统将所有Dojo和自定义模块缩小并压缩为使用untjs.profile.js配置文件的单个JavaScript文件。此配置文件的示例代码如下:
dependencies = {
layers: [{
name: "dojo.js",
customBase: true,
discard: true,
dependencies: ["dojo.dojo","dojo._base","dojo.parser", "dojo.string", "dojo.cache", "dojo.hash", "dojo.fx", "dojo.widget.*", "dojo.widget.ContentPane", "dojo.date", "dojo.date.stamp", "dojo.cookie", "dojo._base.event", "dojo.date", "dojo.date.stamp", "dojo.fx", "dojo.i18n"]
},
{
name: "../dijit/dijit.js",
resourceName: "dijit",
dependencies: ["dijit.dijit", "dijit.layout.LayoutContainer", "dijit.Menu", "dijit._KeyNavContainer", "dijit.MenuItem", "dijit.Dialog", "dijit.form.Button", "dijit.layout", "dijit.layout.ContentPane", "dijit.layout.TabContainer", "dijit.form.Textarea", "dijit.form.SimpleTextarea", "dijit.Dialog", "dijit.dijit-all", "dijit.form.SimpleTextarea", "dijit.form._FormWidget", "dijit._Widget", "dijit._Templated", "dijit._base", "dijit._Container", "dijit._HasDropDown", "dijit.layout._TabContainerBase", "dijit.layout.TabController", "dijit.layout.ScrollingTabController", "dijit.layout.StackContainer", "dijit._Templated", "dijit.layout._LayoutWidget", "dijit._Container", "dijit._Contained", "dijit.layout.StackController", "dijit.layout.SplitContainer", "dijit.form.ToggleButton", "dijit.TitlePane"],
discard: true
}, {
name: "../dojox/layout/ScrollPane.js",
resourceName: "dojox.layout.ScrollPane",
layerDependencies: ["dojo.js", "../dijit/dijit.js"],
dependencies: ["dojox.layout.ScrollPane"],
discard: true
}, {
name: "../untjs.js",
resourceName: "untjs",
layerDependencies: ["dojo.js", "../dijit/dijit.js", "../dojox/layout/ScrollPane.js"],
dependencies: ["global.init", "global.untconfig", "global.historymanager", "user.cookiedata", "user.registration", "user.auth", "common.animation", "common.category", "common.fields", "common.header", "common.nodes", "common.popup", "common.posttype", "common.timestamp", "common.validation", "common.watermark", "common.category", "page.home", "page.profile", "page.people", "page.terms", "page.about", "page.landing", "page.privacy", "page.template", "xhr.friends", "xhr.suggestions", "xhr.requests", "xhr.categories", "xhr.posts", "xhr.comments", "xhr.terms", "xhr.about", "xhr.userinfo", "xhr.privacy", "xhr.cookieUnT", "xhr.registerUnT", "controls.fbinvite", "controls.friends", "controls.mylikes", "controls.activitystream", "controls.people", "controls.requests", "controls.suggestions", "controls.userinfo", "controls.tellsomethingbox"]
}],
prefixes: [["dijit", "../dijit"],["dojox", "../dojox"], ["global", "../../global"], ["page", "../../page"], ["user", "../../user"], ["xhr", "../../xhr"], ["common", "../../common"], ["controls", "../../controls"], ["catalog", "../../catalog"]]
};
但是当我以下列方式执行build.bat命令时:
build.bat release
Name=untjs releaseDir=..\..\..\untjs profileFile=..\..\..\untjs.profile.js actio
n=clean,release optimize=shrinksafe mini=true internStrings=true
我收到以下错误。
犀牛 负载(” ./../../../ untjs / untjs / DojoX中/网格/ NLS / DataGrid_ar.js') 失败。例外:SyntaxError: 语法错误js: “./jslib/i18nUtil.js”,第244行: 来自未捕获的JavaScript的例外 throw:无法创建扁平捆绑 对于src文件: ../../../untjs/untjs/dojox/grid/nls/ DataGrid_ar.js
另外我不明白为什么dojo构建系统正在构建文件(如dojox.grid.datagrid
),我根本不包括在配置文件中。
我希望有人能够解决这个令人沮丧的问题。
答案 0 :(得分:0)
这可能是编码问题。你的jvm有没有机会运行UTF-8以外的默认值?我认为该工具应该指定UTF-8,但如果使用其他东西,这将解释错误。
优化设置会压缩树中的所有文件,而不仅仅是您正在构建的图层,因此会处理dojox.grid及其nls依赖项等模块。如果您只想处理图层文件,请尝试使用layerOptimize。