Skip to content

ci: add bundle analysis to frontend CI pipeline #39

@snowrugar-beep

Description

@snowrugar-beep

Problem Statement

Frontend CI builds but does not output or compare bundle sizes. Bundle size regressions (e.g., from adding a large dependency) go unnoticed until production.

Evidence

  • infrastructure/ci/frontend-build.yml — Build step has no bundle analysis
  • analytics/next.config.ts — Uses @next/bundle-analyzer (available but not used in CI)

Impact

Bundle size regressions go unnoticed. Performance degradation reaches users.

Proposed Solution

  1. Run @next/bundle-analyzer in the CI build step (set ANALYZE=true)
  2. Output bundle analysis as CI artifact
  3. Add size comparison check against previous build
  4. Fail build if bundle size exceeds threshold

Technical Requirements

  • Must not significantly increase CI build time
  • Must output readable report
  • Must compare against baseline

Acceptance Criteria

  1. CI produces bundle analysis artifact
  2. Report is accessible from CI run
  3. Bundle size changes are visible in PR comments
  4. Build fails if size exceeds threshold

File Inventory

  • infrastructure/ci/frontend-build.yml

Dependencies

None.

Testing Strategy

  • Run CI with bundle analysis, verify artifact is generated

Security Considerations

Source maps in bundle analysis should not expose internal paths.

Definition of Done

  • Bundle analysis in CI
  • Artifact uploaded
  • Threshold check implemented

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions