cnpm install --save-dev babel-polyfill
// pakage.json
"babel-polyfill": "^6.26.0",
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8",
"ie 8",
"Android >= 3.2",
"Firefox >= 20",
"iOS 7"
]
// vue.config.js
引入 require('babel-polyfill')
然后在module.exports下面
// 关键配置:node_modules里面需要用babel-loader进行编译的包(node_modules的包如果没做 es6 => es5 转码则需要自己用babel-polyfill进行手动处理)
// 如果IE下还跑不起来,控制台发现有其他es6语法的,尝试调试去找到底是哪个包
transpileDependencies: [
process.env.NODE_ENV === 'development' ? ['*'] : []
]
// main.js
// SCRIPT5022: [vuex] vuex requires a Promise polyfill in this browser.
window.Promise = window.Promise || Promise
import 'babel-polyfill'
效果