Modern CLI fail with class properties



  • I was given a try to modern build, but quasar CLI failed to compile on my classes where properties are declared.

    Module parse failed: Unexpected token (7:16)
    File was processed with these loaders:
     * ./node_modules/eslint-loader/dist/cjs.js
    You may need an additional loader to handle the result of these loaders.
    | 
    | class Profile extends Model {
    >   static prefix = 'accounts'
    |   static apiPath = 'profile'
    | 
    
    

    I understood that properties are not Stage 4 features, but all the help I found say to use babel-eslint not just eslint. I checked my .eslintrc.js (I think it’s the quasar’s default) it’s there but it’s not working.

      parserOptions: {
        parser: 'babel-eslint',
        sourceType: 'module'
      },
    

    Any hints?



  • AFAIK, in modern build, babel isn’t used at all, so, I guess it won’t work.

    Unless you absolutly need these properties to be static, you can add a constructor inside your models, and set prefix and apiPath in it. But the properties will be instance properties…



  • Yes, I need them to be static. Ok, so I don’t use modern then. Is there a plan to support babel “soon”?



  • A “modern + babel” support is planned : https://quasar.dev/quasar-cli/modern-build#Future-plans



  • Hurra! Thanks a lot.


Log in to reply