Registry / devops / vite-plugin-total-bundle-size

vite-plugin-total-bundle-size

JSON →
library1.0.8jsnpmunverified

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.

npm install vite-plugin-total-bundle-size
INSTALL
IMPORT
SIG · VITE-PLUGIN-TOTAL-
V
vite-plugin-total-bundle-size
devopsjavascriptv1.0.8
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

totalBundleSize
import { totalBundleSize } from 'vite-plugin-total-bundle-size'
import totalBundleSize from 'vite-plugin-total-bundle-size'
Named export, not default.
TotalBundleSizeOptions
import { TotalBundleSizeOptions } from 'vite-plugin-total-bundle-size'
const { TotalBundleSizeOptions } = require('vite-plugin-total-bundle-size')
Named export for type options. TypeScript only.
totalBundleSize() in config
plugins: [totalBundleSize()]
plugins: [totalBundleSize]
Must call the function to return a plugin instance.

Configures the Vite plugin with options: only .js/.css files, print per-file stats, disable gzip calculation.

// vite.config.ts import { defineConfig } from 'vite'; import { totalBundleSize } from 'vite-plugin-total-bundle-size'; export default defineConfig({ plugins: [ totalBundleSize({ fileNameRegex: /\.(js|css)$/, printFileStats: true, calculateGzip: false, }), ], });
Debug
Known issues
gotchaPlugin must be placed in the plugins array; providing the function reference instead of calling it will cause an error.
fix
Ensure you call totalBundleSize() in the plugins array, not just pass totalBundleSize.
affects: >=1.0.0
gotchaWhen using CommonJS (require), you cannot use destructuring for named exports in most setups; use the default import pattern or use dynamic import.
fix
Use import syntax or const { totalBundleSize } = require('vite-plugin-total-bundle-size') if the package supports it (it's ESM-first).
affects: >=1.0.0
breakingRequires Vite >=5.0.0. Older Vite versions (especially 4.x) will not work.
fix
Upgrade Vite to version 5 or above.
affects: 1.0.0 - 1.0.8
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-total-bundle-size'
Package not installed or missing in node_modules.
fix
npm i -D vite-plugin-total-bundle-size
TypeError: totalBundleSize is not a function
Attempted to use totalBundleSize as a plugin without calling it, e.g., plugins: [totalBundleSize].
fix
Use plugins: [totalBundleSize()]
Error: The plugin doesn't support the current version of Vite.
Vite version <5.0.0, which is not supported.
fix
Upgrade Vite to >=5.0.0
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
viterequiredPeer dependency: requires Vite >=5.0.0
Agent activity
10 hits · last 30 days
node
10
Resources
vite-plugin-total-bundle-size — npm install vite-plugin-total-bundle-size · libregistry