TreeShaking using webpack

  • Hi!
    I create App with Nuxt, and using nuxt build for building bundle.

    1. install Quasar into project: vue add quasar
    2. add code into app
    import Vue from 'vue'
    import '../../assets/stylus/quasar.styl'
    import '@quasar/extras/material-icons/material-icons.css'
    import {default as Quasar} from 'quasar'
    import {
    } from 'quasar'
    Vue.use(Quasar, {
      config: {},
      components: {
      directives: {
      plugins: {
    1. create bundle npm run build
    2. analyze bundle and see, that all quasar components is included, however i use unly one QBtn.

    How can i minimize bundle size by treeshaking?

  • Make sure your in your quasar.conf.js that framework.components is not set to all. This is where you add the components you are using and quasar will do the treeshaking for you.

  • @Hawkeye64
    I dont use quasar-cli. For project building i use webpack (ver. 4.33) itself (npm run build).

    "scripts": {
        "build": "webpack --mode=production --devtool source-map --progress"

    TreeShaking works perfectly with simple test modules, as described in manual, but wont with Quasar.

    I try remove import {default as Quasar} from 'quasar' then bundle size decreases, and contain only QBtn.


    Exactly import {default as Quasar} pulls along all quasar components.


  • coz default installs all quasar options. you can see it if you print it in the logs.

  • I would think that import {default as Quasar} from 'quasar' would bring in exactly everything.
    Why not be specific, import {QBtn} from 'quasar'?

Log in to reply