我正在尝试为应用程序创建自定义构建,我的项目是在没有root js文件的mvc中,现在我正在尝试使用dojo版本1.9.3将所有javascript文件构建到一个新的js文件中。 构建是成功的,但是当我尝试使用新的构建js文件加载应用程序时,“不是函数”错误。 我的javascript文件未完全转换为amd。 profile.js看起来像
var profile = {
basePath: '../src/',
releaseDir: "/assets/js_prod/",
action: 'release',
mini: true,
optimize: 'Closure',
layerOptimize: 'Closure',
packages: [
{
name: "dojo",
location: "assets/dojo_build/dojo"
}, {
name: "js",
location: "assets/js"
},{
name: "dijit",
location: "assets/dojo_build/dijit"
},{
name: "dojox",
location: "assets/dojo_build/dojox"
} /*,{
name: "css",
location: "assets/css"
} */
],
stripConsole: 'all',
selectorEngine: 'lite',
layers: {
'dojo/dojo': {
customBase: true,
boot: true,
},
'js/testbuild': {
include: [
'js/abcaction',
'js/api',
'js/abc',
'js/Dropdown',
'js/abc',
'js/test',
'js/datas',
'js/history',
'js/library'
]
}
},
staticHasFeatures: {
'dojo-trace-api':0,
'dojo-log-api':0,
'dojo-publish-privates':0,
'dojo-sync-loader':0,
'dojo-xhr-factory':0,
'dojo-test-sniff':0
}
};
包括构建文件(testbuild.js)看起来像
<script data-dojo-config="async: 1, dojoBlankHtmlUrl: '/blank.html',
packages: [ {
name: 'buildjs',
location: '/assets/js_prod'
} ]"
src="/assets/js_prod/dojo/dojo.js"></script>
require([
"buildjs/testbuild"
], function(testbuild) {
testbuild.abcactionInit(false);
});