2025-09-26 16:30:00 +09:00
|
|
|
# 📊 Bundle Analysis
|
|
|
|
|
|
|
|
|
|
Simple bundle size analysis for the customer portal.
|
|
|
|
|
|
|
|
|
|
## 🎯 Quick Commands
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Analyze frontend bundle
|
|
|
|
|
pnpm analyze
|
|
|
|
|
|
2025-09-26 17:02:36 +09:00
|
|
|
# Run bundle analysis script
|
2025-09-26 16:30:00 +09:00
|
|
|
pnpm bundle-analyze
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 📈 What to Look For
|
|
|
|
|
|
|
|
|
|
- **First Load JS**: < 250KB (good)
|
|
|
|
|
- **Total Bundle**: < 1MB (good)
|
|
|
|
|
- **Large Dependencies**: Consider alternatives
|
|
|
|
|
|
|
|
|
|
## 🔧 Simple Optimizations
|
|
|
|
|
|
|
|
|
|
1. **Dynamic Imports**: Use `lazy()` for heavy components
|
2025-09-26 17:02:36 +09:00
|
|
|
2. **Image Optimization**: Use Next.js `Image` component
|
2025-09-26 16:30:00 +09:00
|
|
|
3. **Tree Shaking**: Import only what you need
|
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
// Good: Specific imports
|
2025-09-26 17:02:36 +09:00
|
|
|
import { debounce } from "lodash-es";
|
2025-09-26 16:30:00 +09:00
|
|
|
|
|
|
|
|
// Bad: Full library import
|
2025-09-26 17:02:36 +09:00
|
|
|
import * as _ from "lodash";
|
2025-09-26 16:30:00 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
That's it! Keep it simple.
|