错误信息:语法错误
1.引入babel-polyfill
npm i --save babel-polyfill
在main.js的顶部使用 import ‘babel-polyfill’
2.在babel.config.js中设置
babel.config.js位于项目根目录下
module.exports = {
presets: [
['@vue/app', {
'useBuiltIns': 'entry',
polyfills: ['es6.promise', 'es6.symbol']
}]
],
'env': {
'development': {
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
'plugins': ['dynamic-import-node']
}
}
}
该依赖默认不包括node_modules文件夹中文件
3.在config.js中添加
括号内填写需要被包括的依赖包名
transpileDependencies: ['element-ui']