Registry / devops / vite-size

vite-size

JSON →
library0.0.6jsnpmunverified

vite-size is a lightweight CLI tool that measures the bundle size of any Vite build output. It provides quick feedback on bundle size directly from the terminal without needing additional reporting tools. The current stable version is 0.0.6, released as an early-stage package with no fixed release cadence. Key differentiators include simple setup via npm scripts, support for external packages via --externals flag, and a --lib mode for library projects without an index.html. It ships TypeScript types and works with any Vite project.

npm install vite-size
INSTALL
IMPORT
SIG · VITE-SIZE
V
vite-size
devopsjavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default (CLI)
npx vite-size
import viteSize from 'vite-size'
vite-size is a CLI tool, not a library. It is used via npx or as a script in package.json.
None (type exports)
// No import needed for types; types are bundled for CLI only
import { ViteSizeOptions } from 'vite-size'
vite-size does not export any symbols, only provides CLI functionality.

Shows how to set up a size check script in package.json, including externals and lib mode flags.

// package.json { "scripts": { "size": "npx tsc && vite-size" } } // Then run: npm run size // With externals: // "size": "npx tsc && vite-size --externals react react-dom" // For lib mode (no index.html): // "size": "npx tsc && vite-size --lib --externals react"
vite-size --version
Debug
Known issues
gotcha--externals must be the last flag in the script; otherwise it may not parse correctly
fix
Always put --externals at the end of the command line arguments.
affects: >=0.0.1
gotchaRequires a TypeScript compilation step (npx tsc) before running; otherwise may report on stale output
fix
Run npx tsc first or ensure your build is up-to-date.
affects: >=0.0.1
deprecatedCLI only, no programmatic API available
fix
Use CLI via npx or scripts; do not attempt to import from Node.js.
affects: >=0.0.1
Errors
Common errors & fixes
command not found: vite-size
Package not installed globally or locally
fix
Install as dev dependency: pnpm i -D vite-size or run via npx: npx vite-size
No index.html found. Use --lib for library mode.
Project has no index.html (e.g., library project) and --lib flag not set
fix
Add --lib flag: vite-size --lib
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
viterequiredRequires Vite to be installed in the project to use its build capabilities.
Agent activity
2 hits · last 30 days
node
2
Resources
vite-size — npm install vite-size · libregistry