更新时间:2023-02-06 12:48:40
道场生成器将一个模块标识符,除非你告诉它不添加到每个模块定义。这可以产生的 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" } ] }