我的问题,虽然起初有点类似于这个问题,但似乎是一个更基本的问题 - 并且可能表明构建系统中存在错误。我为我的 dojo 应用程序创建了一个自定义构建。我现在只构建一层,这是配置文件脚本/对象的样子:
dependencies = {
stripConsole: "all",
action: "release",
optimize: "shrinksafe",
releaseName: "myProject",
// list of locales we want to expose
localeList: "en-gb,en-us,de-de",
layers: [
{
// Name: a relative path from the dojo.js in the desination directory.
name: "../../myProject.js",
dependencies: [
"myPackage.MyDataStore",
// MyWidget depends on a few other widgets, and has its own
// translation files.
"myPackage.MyWidget"
]
}
],
prefixes: [
// These paths are relative to the location of dojo.js
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ],
[ "myPackage", "../../../src/myPackage" ]
]
}
当我使用该描述运行构建时,它会在以下目录结构中输出文件:
release/
release/myProject/
release/myProject/dijit/
... dijit ...
release/myProject/dojo/
... dojo ...
release/myProject/dojox/
... dojox ...
release/myProject/myPackage/
... my custom package ...
release/nls/
myProject_en-us.js
myProject_de.js
etc..
../myproject.js
../myProject.js.uncompressed.js
最后,在我的测试 HTML 页面中 - 我有以下内容:
<script type="text/javascript">
var djConfig = {
debug: true,
parseOnLoad: false,
modulePaths: { // paths to directories in relation to dojo's location.... hurr.
'myPackage': '../myPackage',
'dojox': '../dojox',
'dijit': '../dijit'
}
};
</script>
<script type="text/javascript" src="./release/myProject/dojo/dojo.js.uncompressed.js"></script>
<script type="text/javascript" src="./release/myProject.js.uncompressed.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
dojo.require('myPackage.MyDataStore');
dojo.require('myPackage.MyWidget');
var store = new myPackage.MyDataStore();
var widget = new myPackage.MyWidget({
store: store
}, dojo.byId('testWidget'));
widget.startup();
});
</script>
但不幸的是,Firebug 向我吐出了这个:
Bundle not found: MyWidget in myPackage , locale=en-us
我认为正在发生的事情
我已经跟踪了导致上述错误的一些代码,看起来dojo.i18n._preloadLocalizations()
文件末尾的调用实际上并没有从./release/nls
.
知道如何解决此问题,而无需手动包含带有<script>
标签的 nls 文件吗?