r.js 压缩后ie8出现缺少标识错误
r.js 压缩后ie8出现缺少标识错误,如下图:
源码,如下图:
分析下估计ie8不支持直接.finally,需要['finally'],查了下r.js参数配置,没有发现这个的配置,求大神解救
我的压缩合并的配置文件:
({
appDir: "../bda",
baseUrl: ".",
mainConfigFile: "../bda/js/main.js",
//打包输出到的路径
dir: '../bda/dist',
fileExclusionRegExp: /^(r|build)\.js$/,
//如果为true,优化器(optimizer)将从输出目录中删除已合并的文件。
removeCombined: true,
//控制CSS最优化设置
//允许的值:
//none: 不压缩
//standard: 标准压缩方式
//standard.keepLines: 保留换行
//standard.keepComments: 保留注释
//standard.keepComments.keepLines: 保留注释和换行
optimizeCss: "standard",
// 通过正则以文件名排除文件/文件夹
// 比如当前的正则表示排除 .svn、.git 这类的隐藏文件
//fileExclusionRegExp: /^.*\.swf$/,
//模块(modules)的相对目录,相对于脚本的根路径
//优化器
//optimize: "uglify2",
//remove the first comment in js
preserveLicenseComments: false,
optimize: "uglify",
uglify: {
mangle: false, //false 不混淆变量名
quoteKeys:true
},
findNestedDependencies: true,
modules: [
{
name: 'core_js/main'
},
{
name: 'app',
exclude:[
'jquery','angular','angular-animate','angular-sanitize','angular-cookies','angular-touch',
'local-storage','ui-router', 'color-picker','rangy-core','rangy-selectionsaverestore','css','text',
'jqGrid','jqGridLocal','ui-grid','echarts','jquery-ui','ui-bootstrap','angular-strap','angular-strap-tpl',
'bootStrap-js','echarts-theme-dark','spectrum','spectrum-colorpicker','textAngular-Setup','textAngular',
'ui-bootstrap-position','angular-bootstrap-confirm','angular-gridster','abn_tree_directive','drapdrop','commonUtil'
]
},
{
name: 'Controller',
exclude:[ 'jquery','angular','angular-animate','angular-sanitize','angular-cookies','angular-touch',
'local-storage','ui-router', 'color-picker','rangy-core','rangy-selectionsaverestore','css','text','jqGrid','jqGridLocal'
,'ui-grid','echarts','jquery-ui','ui-bootstrap','angular-strap','angular-strap-tpl',
'bootStrap-js','echarts-theme-dark','spectrum','spectrum-colorpicker','textAngular-Setup','textAngular',
'ui-bootstrap-position','angular-bootstrap-confirm','angular-gridster','abn_tree_directive','drapdrop','commonUtil','app']
},
{
name: 'Directive',
exclude:[ 'jquery','angular','angular-animate','angular-sanitize','angular-cookies','angular-touch',
'local-storage','ui-router', 'color-picker','rangy-core','rangy-selectionsaverestore','css','text','jqGrid','jqGridLocal',
'ui-grid','echarts','jquery-ui','ui-bootstrap','angular-strap','angular-strap-tpl',
'bootStrap-js','echarts-theme-dark','spectrum','spectrum-colorpicker','textAngular-Setup','textAngular',
'ui-bootstrap-position','angular-bootstrap-confirm','angular-gridster','abn_tree_directive','drapdrop','commonUtil','app']
},
{
name: 'Service',
exclude:[ 'jquery','angular','angular-animate','angular-sanitize','angular-cookies','angular-touch',
'local-storage','ui-router', 'color-picker','rangy-core','rangy-selectionsaverestore','css','text','jqGrid','jqGridLocal',
'ui-grid','echarts','jquery-ui','ui-bootstrap','angular-strap','angular-strap-tpl',
'bootStrap-js','echarts-theme-dark','spectrum','spectrum-colorpicker','textAngular-Setup','textAngular',
'ui-bootstrap-position','angular-bootstrap-confirm','angular-gridster','abn_tree_directive','drapdrop','commonUtil','app']
}
],
paths:{
"text": "./js/common/requirejs/plugin/text",
"css": "./js/common/requirejs/plugin/css/css",
"core_js": "./js",
"core_style": "./css/theme",
"common_style": "./css/common",
"custom_js": "./js/module/custom",
//一些库文件
'jquery': 'js/common/jquery/jquery-1.9.1',
'angular': 'js/common/angular/1.2.32/angular',
'angular-animate': 'js/common/angular/1.2.32/angular-animate',
'angular-cookies': 'js/common/angular/1.2.32/angular-cookies',
'angular-touch': 'js/common/angular/1.2.32/angular-touch',
'jquery-ui':'js/common/jquery-ui/jquery-ui.min',
'ui-router': 'js/common/angular/ui-route/0.4.3/angular-ui-router',
'ui-grid': 'js/common/angular/ui-grid/4.0.0/ui-grid',
'ui-grid-ie8': 'js/common/angular/ui-grid/4.0.0/ui-grid-ie8',
// "kendoUI": "common/kendoui/kendo.web",
// "kendo": "common/kendoui/kendo.culture.zh-CN",
'jqGrid':'js/common/jqgrid/5.3.0/js/jquery.jqGrid',
'jqGridLocal':'js/common/jqgrid/5.3.0/js/i18n/grid.locale-cn',
'ui-bootstrap': "js/common/angular/ui-bootstrap/ui-bootstrap-tpls-0.11.0",
'angular-strap':'js/common/angular/angular-strap/2.3.12/angular-strap',
'angular-strap-tpl':'js/common/angular/angular-strap/2.3.12/angular-strap.tpl',
// 'angular-treeview': "js/common/angular/treeview/angular.treeview",
// 'echarts': "js/common/echart/4.0.2/echarts.all",
'echarts': "js/common/echart/echarts",
'bootStrap-js':'js/common/bootstrap/3.3.5/bootstrap.min',
'local-storage':'js/common/angular/local-storage/0.5.2/angular-local-storage',
'echarts-theme-dark':'css/common/skin/dark/echart-theme',
'echarts-theme-default':'css/common/skin/default/echart-theme',
//color-picker
'color-picker':'js/common/angular/color-picker/1.0.9/color-picker',
// ztree
'ztree':'js/common/ztree/3.5.32/jquery.ztree.core.min',
//spectrum-color-picker
'spectrum':'js/common/angular/spectrum-colorpicker/1.4.5/spectrum',
'spectrum-colorpicker':'js/common/angular/spectrum-colorpicker/1.4.5/angular-spectrum-colorpicker.min',
'rangy-core': 'js/common/angular/textAngular/1.5.16/rangy-core',
'rangy-selectionsaverestore': 'js/common/angular/textAngular/1.5.16/rangy-selectionsaverestore',
'angular-sanitize':'js/common/angular/textAngular/1.5.16/textAngular-sanitize.min',
'textAngular-Setup':'js/common/angular/textAngular/1.5.16/textAngularSetup',
'textAngular':'js/common/angular/textAngular/1.5.16/textAngular',
'ui-bootstrap-position':'js/common/angular/ui-bootstrap/position',
'angular-bootstrap-confirm':'js/common/angular/angular-bootstrap-confirm/2.5.1/angular-bootstrap-confirm.min',
'angular-gridster':'js/common/angular/angular-gridster/angular-gridster',
'abn_tree_directive':'js/common/angular/angular-nav-tree/abn_tree_directive',
'drapdrop':'js/common/angular/angular-dragdrop/1.0.13/angular-dragdrop',
//js文件
'boot': "js/boot",
'app': "js/common/app",
'router':'js/router',
'Controller': "js/common/controller",
'Service': "js/common/services",
'Filters': "js/common/filters",
'Directive': "js/common/directives",
'commonUtil':'js/common/CommonUtil'
},
shim:{
'Controller':{
deps:['Service']
},
'Directive':{
deps:['Service']
},
'Filters':{
deps:['app']
},
'boot':{
deps:['jquery','css!../bda/css/main.css']
},
'angular':{
exports:'angular'
},
'angular-animate':{
deps:['angular']
},
'angular-touch':{
deps:['angular']
},
'angular-cookies':{
deps:['angular']
},
'router':{
deps:['angular','ui-router','app']
},
'angular-strap':{
deps:['angular','angular-animate']
},
'local-storage':{
deps:['angular']
},
'angular-strap-tpl':{
deps:['angular','angular-animate','angular-strap']
},
'ui-grid':{
deps:['angular']
},
'ui-grid-ie8':{
deps:['angular']
},
'color-picker':{
deps:['angular']
},
'spectrum-colorpicker':{
deps:['angular','spectrum','jquery']
},
'textAngular-Setup':{
deps:['angular']
},
'angular-sanitize':{
deps:['angular']
},
'textAngular':{
deps:['angular','angular-sanitize','textAngular-Setup']
},
'angular-bootstrap-confirm':{
deps:['angular','angular-sanitize','ui-bootstrap-position']
},
'ui-router':{
deps:['angular'],
exports: 'angular-route'
},
'ui-bootstrap-position':{
deps:['angular']
},
'drapdrop':{
deps:['angular','jquery','jquery-ui']
},
'jquery-ui':{
deps:['jquery']
},
'bootStrap-js':{
deps:['jquery']
},
'angular-gridster':{
deps:['jquery','angular']
},
'abn_tree_directive':{
deps:['jquery','angular','bootStrap-js']
},
'app':{
deps:['local-storage','color-picker','echarts','commonUtil']
},
// 'echarts-theme-vintage':{
// deps:['echarts']
// },
'echarts-theme-dark':{
deps:['echarts']
},
'echarts-theme-default':{
deps:['echarts']
},
'ztree':{
deps:['jquery']
},
'jqGrid':{
deps:['jqGridLocal']
},
'jqGridLocal':{
deps:['jquery','css!core_js/common/jqgrid/5.3.0/css/ui.jqgrid.css','css!core_js/common/jqgrid/theme/css/ui-lightness/jquery-ui-1.8.16.custom.css']
}
}
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
自己解决了,r.js的配置文件改成:
感谢楼主分享,也遇到这个问题,也解决了我的问题,非常感谢
感谢楼主的分享,解决了我的问题,我采用的是单一文件out打包模式。