我正在尝试为应用程序创建自定义构建,我的项目在没有根 js 文件的 mvc 中,现在我正在尝试将所有 javascript 文件构建到一个带有 dojo 版本 1.9.3 的新 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);
});