{"id":22887,"library":"vite-plugin-total-bundle-size","title":"vite-plugin-total-bundle-size","description":"Vite plugin that outputs the total size of the bundle after build. Current stable version 1.0.8, released infrequently. It provides a simple way to display bundle size in the console, with options to filter files by regex, print per-file stats, and calculate gzip sizes. Unlike rollup-plugin-visualizer or webpack-bundle-analyzer, it focuses on minimal output and is easy to integrate into CI. Ships TypeScript types. Requires Vite >=5.0.0.","status":"active","version":"1.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/alexeychikk/vite-plugin-total-bundle-size","tags":["javascript","vite","plugin","bundle","size","total","typescript"],"install":[{"cmd":"npm install vite-plugin-total-bundle-size","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-total-bundle-size","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-total-bundle-size","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: requires Vite >=5.0.0","package":"vite","optional":false}],"imports":[{"note":"Named export, not default.","wrong":"import totalBundleSize from 'vite-plugin-total-bundle-size'","symbol":"totalBundleSize","correct":"import { totalBundleSize } from 'vite-plugin-total-bundle-size'"},{"note":"Named export for type options. TypeScript only.","wrong":"const { TotalBundleSizeOptions } = require('vite-plugin-total-bundle-size')","symbol":"TotalBundleSizeOptions","correct":"import { TotalBundleSizeOptions } from 'vite-plugin-total-bundle-size'"},{"note":"Must call the function to return a plugin instance.","wrong":"plugins: [totalBundleSize]","symbol":"totalBundleSize() in config","correct":"plugins: [totalBundleSize()]"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { totalBundleSize } from 'vite-plugin-total-bundle-size';\n\nexport default defineConfig({\n  plugins: [\n    totalBundleSize({\n      fileNameRegex: /\\.(js|css)$/,\n      printFileStats: true,\n      calculateGzip: false,\n    }),\n  ],\n});","lang":"typescript","description":"Configures the Vite plugin with options: only .js/.css files, print per-file stats, disable gzip calculation."},"warnings":[{"fix":"Ensure you call totalBundleSize() in the plugins array, not just pass totalBundleSize.","message":"Plugin must be placed in the plugins array; providing the function reference instead of calling it will cause an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import syntax or const { totalBundleSize } = require('vite-plugin-total-bundle-size') if the package supports it (it's ESM-first).","message":"When using CommonJS (require), you cannot use destructuring for named exports in most setups; use the default import pattern or use dynamic import.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Vite to version 5 or above.","message":"Requires Vite >=5.0.0. Older Vite versions (especially 4.x) will not work.","severity":"breaking","affected_versions":"1.0.0 - 1.0.8"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm i -D vite-plugin-total-bundle-size","cause":"Package not installed or missing in node_modules.","error":"Error: Cannot find module 'vite-plugin-total-bundle-size'"},{"fix":"Use plugins: [totalBundleSize()]","cause":"Attempted to use totalBundleSize as a plugin without calling it, e.g., plugins: [totalBundleSize].","error":"TypeError: totalBundleSize is not a function"},{"fix":"Upgrade Vite to >=5.0.0","cause":"Vite version <5.0.0, which is not supported.","error":"Error: The plugin doesn't support the current version of Vite."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}