bundle-size

Audits JavaScript bundle composition and dependency costs in Vite React builds.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/TierOne-Studio/spa-velocity --skill bundle-size-tierone-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bundle-size
Source: https://github.com/TierOne-Studio/spa-velocity/tree/main/.ruler/skills/bundle-size
Command: npx skills add https://github.com/TierOne-Studio/spa-velocity --skill bundle-size-tierone-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend bundles silently grow with every new dependency, barrel import, and accidental polyfill, degrading load performance for users on slow connections. This Skill provides rules and an audit workflow to keep Vite/React bundle output lean. ## Core Features & Use Cases - Dependency gate: Enforces an approval checklist (size, license, maintenance, alternatives) before adding any new npm dependency. - Tree-shaking guidance: Prescribes narrow imports, sideEffects declarations, and per-method utility imports to avoid pulling entire libraries. - Code splitting patterns: Uses dynamic imports and route-level lazy loading to keep heavy features out of the initial chunk. - Use Case: A pull request adds moment.js for date formatting. The Skill flags the ~250KB cost and recommends date-fns per-method imports or native Intl.DateTimeFormat instead. ## Quick Start Ask the assistant to review a new dependency or investigate why a Vite build chunk grew, and it will apply the bundle audit checklist.

Frequently Asked Questions about bundle-size

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce bundle size in a Vite React app?

Import narrowly from specific modules instead of package roots, lazy-load route-level features with dynamic imports, and avoid polyfills for unsupported browsers. Run the build with rollup-plugin-visualizer to identify which libraries dominate each chunk.

How do I check an npm package size before installing?

Check bundlephobia.com or packagephobia.com for minified and gzipped sizes, then verify the package is ESM with sideEffects set to false so tree-shaking works. Also review peer dependencies, license, maintenance activity, and security advisories before adding it.

date-fns vs moment.js for bundle size?

moment.js adds roughly 250KB and is largely deprecated, while date-fns supports per-method imports like import format from 'date-fns/format' at about 3KB. For simple formatting, native Intl.DateTimeFormat costs zero bundle bytes.

Why does importing lodash increase my bundle so much?

A default import of lodash pulls the entire library, around 70KB, because it defeats tree-shaking. Use per-method imports like lodash/debounce, or replace the utility with a native or local implementation.

When should I use dynamic imports for code splitting?

Use dynamic imports with React.lazy for route-level features like chart pages, markdown editors, or playgrounds that are not needed on initial load. Vite emits each dynamic import as a separate chunk under dist/assets.

When is bundle analysis the wrong tool for performance problems?

Bundle analysis addresses download size, not runtime cost. For rerender and list virtualization issues use a runtime performance skill, and for dev-server speed or chunk strategy configuration use Vite-specific tooling instead.