National Palace Museum

    quasar-unused-plugin
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.4 • Public • Published

    Quasar Unused Plugin

    This is a Webpack 5 plugin for tree shaking unused Quasar components from generated bundles. If you are using Quasar as a standalone UI library with Webpack, then you will be importing from node_modules/quasar/dist/quasar.esm.prod.js. However, Webpack cannot tree shake unused components from this file because this file contains circular references. We can instead import the source code from quasar/src/index.all and use this plugin to break the dependency chain.

    import { QuasarUnusedPlugin } from 'quasar-unused-plugin'
    
    export default {
        plugins: [
            new QuasarUnusedPlugin(),
        ],
    }

    Update your imports from quasar to quasar/src/index.all

    import { createApp } from 'vue'
    import { Quasar } from 'quasar/src/index.all'
    
    const app = createApp(App)
    app.use(Quasar, {})

    If you are using TypeScript, you need to create a definition file (e.g. quasar.d.ts) for quasar/src/index.all

    declare module 'quasar/src/index.all' {
        export * from 'quasar'
    }

    If you are externalizing node modules, you need to allowlist quasar

    import nodeExternals from 'webpack-node-externals'
    
    export default {
        externals: [
            nodeExternals({
                allowlist: [
                    /^quasar*/,
                ],
            }),
        ],
    }

    Keywords

    none

    Install

    npm i quasar-unused-plugin

    DownloadsWeekly Downloads

    35

    Version

    0.1.4

    License

    MIT

    Unpacked Size

    68.3 kB

    Total Files

    76

    Last publish

    Collaborators

    • trinovantes