[Vuejs]-SyntaxError when using spread operator in .vue files in Elixir Phoenix 1.3 app

2👍

You’re using ES6 stage-2 syntax.

First you need to install the package

npm install --save-dev babel-preset-stage-2

and update your .babelrc

{
  "presets": ["stage-2"]
}

You may check it here

0👍

Installing ‘babel-preset-stage-2’ will also install ‘babel-preset-stage-3’ which is the package that actually supports the spread operator. Additionally you need to install ‘babel-preset-env’ like so:

npm install babel-preset-env --save-dev

Finally, you edit file .babelrc like so:

{
  "presets": ["env", "stage-3"]
}

Leave a comment