Back to 🚢 DevOps & Deployment

Analyze Bundle Size

PerformanceNext.jsOptimization
---
description: Visualize and reduce your production build size
---

1. **Install Analyzer**:
- Install the Next.js bundle analyzer.
// turbo
- Run npm install @next/bundle-analyzer

2. **Configure next.config.js**:
- Wrap your config.
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
module.exports = withBundleAnalyzer({
// Other config options
})


3. **Run Analysis**:
- Build with analysis enabled.
// turbo
- Run ANALYZE=true npm run build

4. **Pro Tips**:
- Works with **TurboPack** in Next.js 15.
- Look for large libraries (like lodash or moment) that can be tree-shaken or replaced.
- Use import { x } from 'package' instead of import package from 'package'.
By Antigravity Team

How to Use This Workflow

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/workflows/
  3. Save the file as analyze-nextjs-bundle-size-optimization.md
  4. In Antigravity, type /analyze_nextjs_bundle_size_optimization or just describe what you want to do

Learn more about workflows →

Related Workflows

Recommended Rules

View more rules →

Recommended MCP Servers

View more MCP servers →

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide