Skip to content

Conversation

charlesBochet
Copy link
Member

As per title

@charlesBochet charlesBochet merged commit 81e9a02 into main Oct 3, 2025
31 checks passed
@charlesBochet charlesBochet deleted the increase-chunk-limit branch October 3, 2025 15:32
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR increases the main chunk size limit in the Vite configuration from 5.3MB to 5.5MB (approximately 200KB increase). The change modifies the `MAIN_CHUNK_SIZE_LIMIT` constant in `packages/twenty-front/vite.config.ts` to accommodate a larger bundle size.

The modification directly contradicts an explicit comment in the code that warns against increasing this limit and instead recommends finding modules that can be loaded lazily. This suggests the codebase has been designed with bundle size optimization in mind, where the chunk size limits serve as guardrails to prevent bundle bloat and encourage proper code splitting.

This type of change typically occurs when the main bundle grows beyond the current limit due to new features or dependencies, causing build failures. Rather than investing time to identify and lazy-load modules (the recommended approach), this PR takes the expedient path of raising the limit to unblock development.

Important Files Changed

Changed Files
Filename Score Overview
packages/twenty-front/vite.config.ts 3/5 Increased main chunk size limit from 5.3MB to 5.5MB, ignoring explicit guidance to lazy-load modules instead

Confidence score: 3/5

  • This PR is relatively safe to merge but goes against established optimization guidelines
  • Score reflects the band-aid nature of the fix rather than addressing the root cause of bundle bloat
  • Pay close attention to packages/twenty-front/vite.config.ts for adherence to bundle size optimization practices

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Vite as Vite Build System
    participant Config as vite.config.ts
    participant Checker as Chunk Size Checker Plugin
    participant Bundle as Bundle Generator

    Dev->>Vite: "Run build command"
    Vite->>Config: "Load configuration"
    Config->>Config: "Set MAIN_CHUNK_SIZE_LIMIT = 5.5MB"
    Config->>Config: "Set OTHER_CHUNK_SIZE_LIMIT = 5MB"
    Config->>Vite: "Return build configuration"
    Vite->>Bundle: "Generate bundle chunks"
    Bundle->>Checker: "Call generateBundle() with chunks"
    
    loop For each chunk in bundle
        Checker->>Checker: "Calculate chunk size"
        Checker->>Checker: "Determine if main chunk (index + isEntry)"
        Checker->>Checker: "Apply size limit (5.5MB main, 5MB other)"
        alt Chunk exceeds limit
            Checker->>Checker: "Add to oversizedChunks array"
        end
    end
    
    alt oversizedChunks.length > 0
        Checker->>Vite: "this.error() - Build failed with size details"
        Vite->>Dev: "Build failure with chunk size report"
    else All chunks within limits
        Checker->>Vite: "Continue build process"
        Vite->>Dev: "Build successful"
    end
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

github-actions bot commented Oct 3, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:45679

This environment will automatically shut down when the PR is closed or after 5 hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant