ES6扩展运算符(...)无法解析

Syntax Error:Unexpected token(203,8)

1. npm install babel-plugin-transform-object-rest-spread

2. 在根目录配置.babelrc文件识别es6语法

{
 "presets": [
  ["env", {
   "modules": false,
   "targets": {
    "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
   }
  }],
  "stage-2"
 ],
 "presets": [
  ["es2015", { "modules": false }]
 ],
 "plugins": ["transform-object-rest-spread"]
}

3. npm install babel-preset-es2015 --save-dev

你可能感兴趣的:(vue项目常见报错)