spread operator in vuex not working with any presets



  • I am trying to use vuex …mapGetters() function and always quasar dev throws the following error: “Unexpected token”

    I am using lastest version of quasar 1.4.1. After google it and try different kind of suggestions I couldn’t make it work.
    Here are the babel.conf.js combinations I tried without success.

      presets: [
        [
          '@quasar/babel-preset-app', {
            presetEnv: { corejs: 3 }
           }
        ],
        '@babel/preset-react',
      ],
      plugins: [
        '@babel/plugin-proposal-object-rest-spread',
      ],
    
      presets: [
        '@quasar/babel-preset-app',
        '@babel/preset-env',
      ],
      plugins: [
        '@babel/plugin-proposal-object-rest-spread',
      ],
    

    I appreciate your help.

    thanks



  • I dont think you need to add those in babel, are you sure you installed vuex in your project. Pls, Provide more info.



  • Hi @metalsadman thanks for answering,

    After you mentioned if I had vuex in the project I search more than I had it installed but I was importing the function wrong

     import { ...mapGetters } from 'vuex';
    

    I fixt the error by importing it right.

    thanks again and sorry