In this answer the following syntax's been suggested.
import { mapActions } from 'vuex'
export default {
vuex: {
getters: { activeDataRow: state => state.activeDataRow },
actions: { updateData, resetData }
},
methods: { ...mapActions(['updateData', 'resetData']) }
}
I can't make it work and I'm getting the error:
Module build failed: SyntaxError: C:/.../navigation.vue: Unexpected token (30:8)
29 | methods: {
30 | ...mapActions(['updateData', 'resetData'])
| ^
31 | }
I've tried configuring Babel to stage-2 and adding plugins but it made no change. What can be done about it? How do I troubleshoot it?
babel: {
presets: ["es2015", "stage-2"],
plugins: ["transform-object-rest-spread"]
}
webpack.config.js
module.exports = {
entry: './index.js',
output: { path: __dirname, filename: 'bundle.js' },
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
{ test: /\.vue$/, loader: 'vue' }]
},
babel: {
presets: ["es2015", "stage-2"],
plugins: ['transform-runtime']
},
resolve: { alias: { 'vue$': 'vue/dist/vue.common.js' } }
}