Import strategy for Vue CLI plugin?



  • I’m running Quasar as a Vue plugin. My vue.config.js currenly looks as follows:

    module.exports = {
      pluginOptions: {
        quasar: {
          importStrategy: 'kebab',
          rtlSupport: false
        },
        webpackBundleAnalyzer: {
          openAnalyzer: true
        }
      },
      transpileDependencies: [
        'quasar'
      ],
      pwa: {
         [...]
        }
      }
    }
    
    

    The site works fine, but all Quasar components are imported, not just the ones I use. On the other hand, if I replace

    importStrategy: 'kebab'
    

    with

    all: 'auto'
    

    the site breaks; many components (e.g. QLayout, QList etc.) that are used aren’t included.

    I couldn’t find any documentation on the matter. Although the docs do have autoand all as possible values for importStrategy, if I try importStrategy: auto, I get an error:

    Incorrect setting for quasar > importStrategy (auto)
    Use one of: 'kebab', 'pascal', 'combined', 'manual'.
    

    This probably has something to do with v1.1.2 and issue #5098, but I’ve read through those and still can’t understand what the correct solution is.

    To add to the confusion, I also have the following in src/quasar.js:

    Vue.use(Quasar, {
      config: {
      },
      importStrategy: 'auto',
      components: { /* not needed if importStrategy is not 'manual' */ },
      directives: { /* not needed if importStrategy is not 'manual' */ },
      plugins: [
        Cookies,
        Notify
      ],
      lang: lang
    })
    
    

    So – where do I set the import strategy, and how do I do it properly?

    Thanks!



  • You need to place it as such:

    framework:{ all:'auto' }


Log in to reply