{"id":26606,"library":"vite-size","title":"vite-size","description":"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.","status":"active","version":"0.0.6","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","vite","bundle size","script","typescript"],"install":[{"cmd":"npm install vite-size","lang":"bash","label":"npm"},{"cmd":"yarn add vite-size","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-size","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Requires Vite to be installed in the project to use its build capabilities.","package":"vite","optional":false}],"imports":[{"note":"vite-size is a CLI tool, not a library. It is used via npx or as a script in package.json.","wrong":"import viteSize from 'vite-size'","symbol":"default (CLI)","correct":"npx vite-size"},{"note":"vite-size does not export any symbols, only provides CLI functionality.","wrong":"import { ViteSizeOptions } from 'vite-size'","symbol":"None (type exports)","correct":"// No import needed for types; types are bundled for CLI only"}],"quickstart":{"code":"// package.json\n{\n  \"scripts\": {\n    \"size\": \"npx tsc && vite-size\"\n  }\n}\n// Then run:\nnpm run size\n\n// With externals:\n// \"size\": \"npx tsc && vite-size --externals react react-dom\"\n\n// For lib mode (no index.html):\n// \"size\": \"npx tsc && vite-size --lib --externals react\"","lang":"javascript","description":"Shows how to set up a size check script in package.json, including externals and lib mode flags."},"warnings":[{"fix":"Always put --externals at the end of the command line arguments.","message":"--externals must be the last flag in the script; otherwise it may not parse correctly","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Run npx tsc first or ensure your build is up-to-date.","message":"Requires a TypeScript compilation step (npx tsc) before running; otherwise may report on stale output","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use CLI via npx or scripts; do not attempt to import from Node.js.","message":"CLI only, no programmatic API available","severity":"deprecated","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install as dev dependency: pnpm i -D vite-size or run via npx: npx vite-size","cause":"Package not installed globally or locally","error":"command not found: vite-size"},{"fix":"Add --lib flag: vite-size --lib","cause":"Project has no index.html (e.g., library project) and --lib flag not set","error":"No index.html found. Use --lib for library mode."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}