Skip to content

Instantly share code, notes, and snippets.

@mostafa6765
Last active October 18, 2017 21:59
Show Gist options
  • Save mostafa6765/d20ac9d53159e7677e7dc9606dd0ac53 to your computer and use it in GitHub Desktop.
Save mostafa6765/d20ac9d53159e7677e7dc9606dd0ac53 to your computer and use it in GitHub Desktop.
map issue vuex babel vue

Running the following:

yarn add --dev babel-preset-es2015 babel-preset-stage-2

Then creating a .babelrc in the root of our project with:

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

Resolved this.

Spread syntax about ES6, not about this template. Please check one more time:

import { mapState, mapActions, mapMutations, mapGetters } from 'vuex'

must be added into your file and babel must be configured right.

Also it can be about babel preset. es2015 preset description: Only compiles ES2015 to ES5. Spread is ES6 syntax. Please try with env preset too.

Also check is your presets installed with npm ls --depth=0. If not you can install with this command:

npm install --save-dev babel-loader babel-plugin-transform-runtime babel-preset-stage-2 babel-preset-es2015 or for env:

npm install --save-dev babel-loader babel-plugin-transform-runtime babel-preset-env

So there is so much possibilities, but the template is not inside these possibilities for this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment