Performanceprompt onlyintermediate

Bundle Size Reducer

Iteratively reduces JavaScript bundle size by analyzing dependencies, identifying large modules, and applying targeted optimizations until a specified size target is met.

← all loops
performanceoptimizationbundlesizewebpackjavascript

Goal

Reduce bundle size to target threshold

How to Run

Run automated prompts in your coding environment to iteratively reduce bundle size using analysis and optimization steps.

  1. 01

    Setup Environment

    Ensure you have a bundle analyzer tool installed (e.g., webpack-bundle-analyzer) and can run build commands.

  2. 02

    Run Initial Analysis

    Execute the kickoff prompt to get current bundle size and analysis report.

  3. 03

    Apply Optimization Prompts

    For each iteration, run the generated prompts to identify and apply bundle optimizations.

  4. 04

    Check Results

    After each optimization, run the bundle analyzer to verify size reduction progress.

  5. 05

    Iterate Until Target

    Repeat steps 3-4 until the bundle size meets your target or max iterations reached.

Workflow Steps

  1. 01

    Analyze current bundle composition using bundle analyzer

  2. 02

    Identify top largest modules/dependencies contributing to bundle size

  3. 03

    Research and select appropriate optimization strategies for identified modules

  4. 04

    Apply optimizations via build configuration changes (code splitting, tree shaking, etc.)

  5. 05

    Rebuild and reanalyze bundle to measure impact

  6. 06

    Compare new bundle size against target threshold

    If target met, exit loop; otherwise, return to step 1

Kickoff Prompt

Start the "Bundle Size Reducer" loop.

Goal: Reduce bundle size to target threshold
Max iterations: 10
Between iterations run: bundle analyzer
Exit when: Size target achieved


Please analyze the current JavaScript bundle size using your preferred analyzer tool (e.g., 'npx webpack-bundle-analyzer dist/static/js/*.js'). Report the total bundle size in KB/MB, identify the top 5 largest modules, and indicate whether the current size exceeds our target of [TARGET_SIZE]KB. Include the full analysis output in your response.

Self-pace this loop. After each iteration, run `bundle analyzer` and evaluate the output, and only continue if the exit condition is not met (Size target achieved). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.

Guardrails

hardcoded
  • ·Do not modify source code files directly without prior analysis
  • ·Always backup configuration files before making changes
  • ·Test application functionality after each optimization
  • ·Prioritize safe optimizations over aggressive ones
  • ·Respect iteration limits to prevent infinite loops

Flow Diagram

rendering…

Related loops — Performance