React Bundle Size Reducer

Identify and fix bundle bloat in React applications

Intermediate PerformanceAll Models
prompt template
Analyze and reduce the bundle size of this React application:

**Framework:** [FRAMEWORK — e.g., "Next.js 15"]
**Current bundle:** [SIZE — e.g., "First Load JS: 450KB"]
**Target:** [TARGET — e.g., "under 200KB"]
**Heavy dependencies:** [DEPS — e.g., "moment.js, lodash, chart.js"]

Generate optimizations:
1. **Dependency audit** — identify heavy packages with lighter alternatives
   - moment.js → dayjs or date-fns
   - lodash → native methods or lodash-es with tree-shaking
   - Heavy UI libraries → individual component imports
2. **Code splitting** — dynamic imports for route-level and component-level
3. **Tree shaking** — fix barrel exports that prevent tree shaking
4. **Image optimization** — next/image, WebP/AVIF, responsive sizing
5. **Font optimization** — subset fonts, use next/font
6. **Lazy loading** — defer non-critical below-fold components
7. **Analysis** — webpack-bundle-analyzer or @next/bundle-analyzer setup

Include specific code changes and expected size reduction for each.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results