安装插件

babel-polyfill
babel-plugin-transform-es2015-arrow-functions(转箭头函数)

并进行配置

在webpack.base.config.js中修改为:

context: path. resolve( __dirname, '../'),
entry: {
app:[ 'babel-polyfill', './src/main.js']
},

在main.js中最顶部增加:

import 'babel-polyfill'

在.babelrc文件中修改为:

{
"presets": [
[ "env", {
"modules": false,
"targets": {
"browsers": [ "> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": [ "transform-vue-jsx", "transform-runtime", "transform-es2015-arrow-functions"]
}

即可。
Logo

前往低代码交流专区

更多推荐