Dùng @next/bundle-analyzer để visualize bundle size.
- Cấu hình trong next.config.js với withBundleAnalyzer wrapper.
- Chạy
ANALYZE=true npm run buildđể tạo report HTML. - Giúp identify: large dependencies, duplicate code, unnecessary imports.
- Sau đó tối ưu: dynamic imports, tree-shaking, replace heavy libraries.