Dojo构建1.7建包不起作用 [英] Dojo build 1.7 built packages does not work
问题描述
我在我的建设项目开始时,我得到了不能明白为什么他们正在发生一些错误。
您可以看到我app.profile.js内容
以下文件。我执行建立配置文件= .. / .. / app.profile.js -r
从命令提示符下这条线上,我没有得到任何错误的过程完成后。我的问题是,如果我复制这些包的地方释放(建)版本,其中未建的版本存在,我得到这样太多的JavaScript错误错误:multipleDefine
。即使我只复制道场,DojoX中和的dijit文件夹,同样的错误是不断发生的历史。
当我看到建未建与JS 2的文件之间的差异,(例如道场/递延)我知道唯一的区别是这样的:
//建
定义(道场/延迟,[
./_base/lang
./promise/CancelError
./promise/Promise
],功能(
定义([
./_base/lang
./promise/CancelError
./promise/Promise
],功能(
所以我一开始一点点被卡住。我想用层尽快减少HTTP请求来尝试,但我需要了解我所说的情况有所帮助。任何帮助将大大AP preciated,谢谢。
app.profile.js:
无功配置= {
基本路径:..,
layerOptimize:shrinksafe.keepLines
优化:ShrinkSafe的
RELEASEDIR:./release
hasReport:真实, 包:
{
名称:道场,
位置:./dojo
}, {
名称:的dijit
位置:./dijit
}, {
名称:应用程序,
位置:./app
},
{
名称:DTK
位置:./dtk
},
{
名称:DojoX中
位置:./dojox
}
] 层:{
应用程序/层/芯:{
包括:
道场/ _base /申报,
DTK /芯/ ILifeCycle,
DTK /核心/ AppConfig的
DTK /芯/ TopicContext,
DTK /芯/ NavigationContext,
道场/规定,
道场/ _base /延迟,
道场/ DeferredList
道场/ _base /郎
]
},
应用程序/层/ appcontext:{
包括:
DTK /核心/ AppContext
]
排除:
应用程序/层/芯
] } }
};
道场生成器将一个模块标识符,除非你告诉它不添加到每个模块定义。这可以产生的 multipleDefine误差的
从 Builder文档:
insertAbsMids(默认为未定义)
- [truthy] 原因转换,确保每一件AMD定义
应用程序包含一个模块标识符的说法。
- [falsy] 的
变换无助于在定义模块标识符参数
应用程序。特别是,一个falsy值能源部不会导致
变换以消除存在于一个模块标识符的参数
来源$ C $ C。
块引用>直到我说我有完全相同的问题 insertAbsMids :假的我的个人资料。
例如:
无功配置= {
基本路径:./,
RELEASEDIR:释放,
动作:释放, layerOptimize:ShrinkSafe的
优化:ShrinkSafe的
cssOptimize:评论,
微型:假的,
insertAbsMids:假的, 包:
{名:dijit的位置的dijit},
{名:DojoX中,地点:DojoX中},
{名:道场,地点:道场}
]
}I'm at the beginning of building my project and I get some errors that couldn't realize why they are being occured.
You can see contents of
my app.profile.js
file below. I execute"build profile=../../app.profile.js -r"
this line from command prompt and I get no error after the process is done. My problem is if I copy the release(built) version of these packages to the place where the unbuilt versions exist, I get too many javascript errors like "Error: multipleDefine
". Even if I copy only dojo, dojox and dijit folders, same errors are keep occuring.When I look the differences between built and unbuilt of two js files, (for example dojo/Deferred) the only difference I realize is this:
//built define("dojo/Deferred", [ "./_base/lang", "./promise/CancelError", "./promise/Promise" ], function(
define([ "./_base/lang", "./promise/CancelError", "./promise/Promise" ], function(
So I'm a little bit stucked at the beginning. I want to try using layers to reduce http requests as soon as possible but I need some help about the situation I mentioned. Any help will be greatly appreciated, thanks.
app.profile.js:
var profile = { basePath: "..", layerOptimize: "shrinksafe.keepLines", optimize: "shrinksafe", releaseDir: "./release", hasReport: true, packages: [ { name: "dojo", location: "./dojo" }, { name: "dijit", location: "./dijit" }, { name: "app", location: "./app" }, { name: "dtk", location: "./dtk" }, { name: "dojox", location: "./dojox" } ], layers: { "app/layers/core": { include: [ "dojo/_base/declare", "dtk/core/ILifeCycle", "dtk/core/AppConfig", "dtk/core/TopicContext", "dtk/core/NavigationContext", "dojo/require", "dojo/_base/Deferred", "dojo/DeferredList", "dojo/_base/lang" ] }, "app/layers/appcontext": { include: [ "dtk/core/AppContext" ], exclude: [ "app/layers/core" ] } } };
解决方案The Dojo builder will add a module identifier to every module definition unless you tell it not to. This can produce the multipleDefine error.
From the builder documentation:
insertAbsMids (default = undefined)
- [truthy] Causes the transform to ensure that every AMD define application includes a module identifier argument.
- [falsy] The transform does nothing to the module identifier argument in define applications. In particular, a falsy value doe not cause the transform to remove a module identifier argument that exists in the source code.
I was having exactly the same problem until I added insertAbsMids:false to my profile.
eg:
var profile = { basePath: "./", releaseDir: "release", action: "release", layerOptimize: "shrinksafe", optimize: "shrinksafe", cssOptimize: "comments", mini: false, insertAbsMids: false, packages: [ { name: "dijit", location :"dijit" }, { name: "dojox", location :"dojox" }, { name: "dojo", location :"dojo" } ] }
这篇关于Dojo构建1.7建包不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!