ViVite · Lesson 5 of 6
Build & Optimization
`npm run build` runs Rollup under the hood and produces optimized, code-split output. Vite handles CSS minification, asset hashing, tree-shaking, and chunk splitting automatically.
✦ Tip
After `npm run build`, check the output for chunks larger than 500KB — Vite warns you about them. Use `rollup-plugin-visualizer` to see exactly what's taking up space. The usual culprits: moment.js (use date-fns), lodash (use lodash-es or individual imports), and large icon libraries (import individually, not the whole set).
After `npm run build`, check the output for chunks larger than 500KB — Vite warns you about them. Use `rollup-plugin-visualizer` to see exactly what's taking up space. The usual culprits: moment.js (use date-fns), lodash (use lodash-es or individual imports), and large icon libraries (import individually, not the whole set).