vue cli3 兼容ie浏览器

安装依赖
cnpm install --save babel-polyfill

cnpm install es6-promise --save

在main.js导入
import '@babel/polyfill';
import Es6Promise from 'es6-promise'
Es6Promise.polyfill()

.babelrc文件内配置
{
"presets": [
[
"@vue/app",
{
"useBuiltIns": "entry",
"polyfills": [
"es6.promise",
"es6.symbol"
]
}
]
]
}

babel.config.js文件中配置
module.exports = {
presets: [
[
"@vue/app",
{
"useBuiltIns": "entry",
polyfills: [
'es6.promise',
'es6.symbol'
]
}
]
],
};

vue.config.js文件中配置
chainWebpack: config => {
config.module
.rule('iview')
.test(/iview.src.*?js|.html$|.\css/, // 匹配文件名
threshold: 10240, // 对超过10k的数据压缩
deleteOriginalAssets: false // 不删除源文件
}))
}
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set('_c', resolve('src/components'))
.set('@plugins', resolve('src/plugin'))
},

你可能感兴趣的:(vue cli3 兼容ie浏览器)