我有一个我正在使用requireJs的angularJs项目。我正在尝试优化我的js和CSS。对于js,我已经创建了build.js文件,并做了其他事情来创建优化文件。但是我收到错误消息“无法设置未定义的属性'de'。 我发现此错误是由于第三方库文件input.js引起的。我将其删除,然后在浏览器控制台中未定义错误引导程序。这是我的build.js
({
//appDir: "some/path/",
baseUrl: "./",
//mainConfigFile: 'main.js',
name: "main",
mainConfigFile: "main.js",
out: "main-built.js",
})
这是我的main.js
var apiRoot = apiRoot;//? apiRoot : "/";
require.config({
//This parameter is used for versioning the js files at time of loading, it will resolve the caching problem.
urlArgs: "v=" + new Date().getTime(),
//baseUrl: "js",
waitSeconds: 200,
// alias libraries paths
paths: {
"angular": "../../lib/angular-1.5.5/angular.min",
"angular-ui-router": "../../lib/angular-1.5.5/angular-ui-router.min",
"angularAMD": "../../lib/angularAMD/angularAMD.min",
"ngload": "../../lib/angularAMD/ngload.min",
'jquery': '../../lib/jquery-1.12.3/jquery-1.12.3.min',
'signalR': '../../lib/signalR/jquery.signalR.min',
"signalr.hubs": "../../../" + "signalr/hubs?",
'angularCSS': '../../lib/angular-css/angular-css.min',
'mobile-angular-ui': '../../lib/mobile-angular-ui-1.2.0-rc.3/js/mobile-angular-ui.min',
'bootstrap': '../../lib/bootstrap/js/bootstrap.min',
'echarts3': '../../lib/echarts/js/echarts.min',
"bootstrap-fileinput": "../../lib/bootstrap-fileinput/js/fileinput.min",
"bootstrap-fileinput-de": "../../lib/bootstrap-fileinput/js/locales/de", ////Support for German
"bootstrap-fileinput-cn": "../../lib/bootstrap-fileinput/js/locales/zh-TW", //Support for Chinese
"angular-scrollable-table": "../../lib/angular-scrollable-table/js/angular-scrollable-table.min",
"angular-slider": "../../lib/angular-slider/js/rzslider.min",
"angular-multi-select": '../../lib/angular-multi-select/js/isteven-multi-select',
"ui.bootstrap": "../../lib/ui-bootstrap/ui-bootstrap-tpls-2.1.3.min",
"angular-busy": "../../lib/angular-busy/js/angular-busy.min",
'store': '../../lib/store/store.min',
'sly': '../../lib/sly-1.6.1/sly',
'dndLists': "../../lib/angular-drag-and-drop-lists/angular-dnd-lists.min",
'KpiFormat': "../../lib/apm-kpi-widget/js/apm-kpi-formatter",
'apm-kpi-widget': "../../lib/apm-kpi-widget/js/apm-kpi-widget.min",
'angular-filter': "../../lib/angular-filter/js/angular-filter.min",
'moment': '../../lib/moment/moment',
"angular-translate": '../../lib/angular-translate/angular-translate.min',
"angular-translate-static-files": "../../lib/angular-translate/angular-translate-static-files",
"jQuery-Scrollbar": "../../lib/jquery-scrollbar-0.2.10/js/jquery.scrollbar.min",
"bootstrap-datepicker": "../../lib/bootstrap-datepicker/bootstrap-datetimepicker.min",
"ngMask": "../../lib/ng-mask/ngMask.min",
},
// Add angular modules that does not support AMD out of the box, put it in a shim
shim: {
"angular": { deps: ['jquery'], exports: "angular" },
"angular-ui-router": ["angular"],
"angularAMD": ["angular"],
"ngload": ["angularAMD"],
'signalR': {
deps: ['jquery'],
exports: 'signalR'
},
'moment': {
exports: 'moment'
},
"signalr.hubs": {
deps: ["signalR"]
},
'angularCSS': {
deps: ['angular']
},
'mobile-angular-ui': {
deps: ['angular'],
exports: 'mobile-angular-ui'
},
'bootstrap': {
deps: ['jquery'],
exports: 'bootstrap'
},
'bootstrap-fileinput': {
deps: ['jquery'],
exports: 'bootstrap-fileinput'
},
'bootstrap-fileinput-de': {
deps: ['bootstrap-fileinput'],
exports: 'bootstrap-fileinput-de'
},
'bootstrap-fileinput-cn': {
deps: ['bootstrap-fileinput'],
exports: 'bootstrap-fileinput-cn'
},
'angular-scrollable-table': {
deps: ['jquery', 'angular'],
exports: 'bootstrap-fileinput'
},
"angular-slider": {
deps: ['angular'],
exports: 'angular-slider'
},
"angular-multi-select": {
deps: ['angular'],
exports: 'angular-multi-select'
},
"ui.bootstrap": {
deps: ['angular'],
exports: 'ui-bootstrap'
},
"angular-busy": {
deps: ['angular'],
exports: 'angular-busy'
},
'echarts3': {
exports: 'echarts3'
},
"sly": {
deps: ['jquery'],
exports: 'sly'
},
"dndLists": {
deps: ['angular'],
exports: 'angular-drag-and-drop-lists'
},
"KpiFormat": { deps: ['jquery'], exports: "KpiFormat" },
"apm-kpi-widget": {
deps: ['jquery', 'angular', 'KpiFormat'],
exports: 'apm-kpi-widget'
},
'angular-filter': {
deps: ['jquery', 'angular'],
exports: 'angular-filter'
},
"angular-translate": {
deps: ['angular'],
exports: 'angular-translate'
},
"angular-translate-static-files": {
deps: ['angular', 'angular-translate'],
exports: 'angular-translate-static-files'
},
"jQuery-Scrollbar": {
deps: ['angular'],
exports: 'jQuery-Scrollbar'
},
'bootstrap-datepicker': {
deps: ['moment', 'jquery', 'bootstrap'],
exports: 'bootstrap-datepicker'
},
'ngMask': {
deps: ['angular'],
exports: 'ngMask'
}
},
// kick start application
deps: ['app']
});
这是我的app.js
define([
"angularAMD", "angular-ui-router", 'bootstrap', 'signalR', 'signalr.hubs', 'mobile-angular-ui',"moment",
"bootstrap-fileinput", "bootstrap-fileinput-de", "bootstrap-fileinput-cn", "bootstrap-datepicker", "angular-scrollable-table", "angular-slider", "angular-multi-select",
"ui.bootstrap", "angular-busy", 'sly', "dndLists", 'apm-kpi-widget', "angular-filter", "angular-translate", "angular-translate-static-files", "jQuery-Scrollbar", "ngMask"
],
function (angularAMD) {
var app = angular.module("app",
[
"ui.router",
"mobile-angular-ui",
"scrollable-table", //for alert triggering
"rzModule", //slider for SEMI diagram
"isteven-multi-select",
"ui.bootstrap",
"cgBusy", "dndLists", 'apm-kpi-widget',
'angular.filter',
"pascalprecht.translate",
"jQueryScrollbar",
"ngMask"
])
.value('cgBusyDefaults',
{
minDuration: 700
});
//Other stuff
// Bootstrap Angular when DOM is ready
return angularAMD.bootstrap(app);
});
这是我的index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<title ng-bind="title">APM</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<!--<base href="/Client/apm-main/" />-->
<link href="Client/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="Client/lib/animate/css/animate.min.css" rel="stylesheet" />
<link href="Client/lib/mobile-angular-ui-1.2.0-rc.3/css/ma-ui-base.min.css" rel="stylesheet" />
<link href="Client/lib/mobile-angular-ui-1.2.0-rc.3/css/ma-ui-desktop.min.css" rel="stylesheet" />
<link href="Client/lib/mobile-angular-ui-1.2.0-rc.3/css/ma-ui-hover.min.css" rel="stylesheet" />
<link href="Client/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<link href="Client/lib/bootstrap-datepicker/bootstrap-datetimepicker.css" rel="stylesheet" />
<link href="Client/apm-main/css/base.css" rel="stylesheet" type='text/css'>
<link rel="stylesheet" href="Client/lib/bootstrap-fileinput/css/fileinput.min.css" />
<link rel="stylesheet" href="Client/lib/angular-busy/css/angular-busy.min.css" />
<link rel="stylesheet" href="Client/lib/angular-slider/css/rzslider.css" />
<link rel="stylesheet" href="Client/lib/angular-multi-select/css/isteven-multi-select.css" />
<link rel="stylesheet" href="Client/lib/angular-scrollable-table/css/scrollable-table.css" />
<link rel="stylesheet" href="Client/lib/jquery-scrollbar-0.2.10/css/jquery.scrollbar.css" />
<link rel="stylesheet" href="Client/apm-main/css/param_setting.css" />
<link href="Client/apm-main/css/All.css" rel="stylesheet" />
<link href="Client/apm-main/css/3840x2160.css" rel="stylesheet"/>
<link href="Client/apm-main/css/2560x1440.css" rel="stylesheet"/>
<link href="Client/apm-main/css/1920x1080.css" rel="stylesheet"/>
<link href="Client/apm-main/css/1600x900.css" rel="stylesheet"/>
<link href="Client/apm-main/css/1366x768.css" rel="stylesheet"/>
<link href="Client/apm-main/css/1280x720.css" rel="stylesheet"/>
<link href="Client/apm-main/css/1152x648.css" rel="stylesheet"/>
<link href="Client/apm-main/css/1024x576.css" rel="stylesheet" />
<script>
less = {
env: "production"
};
</script>
</head>
<!--id="wrapper" for toggle right menu-->
<body>
<noscript>
<div class="app-content">
For full functionality of this site it is necessary to enable JavaScript.
</div>
</noscript>
<div class="wrapper" ui-view></div>
<script>
var apiRoot = "";
</script>
<script src="Client/lib/moment/moment.js"></script>
<script data-main="Client/apm-main/js/main-built.js" src="Client/lib/require-2.2/require.js"></script>
</body>
</html>
谁能告诉我这是什么问题?似乎垫片区域有问题。