Skip to content

perf: reduce first-load JS below 200kB on auth, settings, and workspace home pages #964

@sw-factory-automations

Description

@sw-factory-automations

Description

The Week 19 performance report shows 7 of 11 pages still exceed the 200kB gzipped first-load JS budget. Previous issues #951 (auth pages) and #952 (settings pages) were closed as completed, but the latest build output shows the regressions persist or were re-introduced:

Page Current Size Budget Over By
/sign-in 286.0 kB 200 kB +86 kB
/sign-up 286.1 kB 200 kB +86 kB
/forgot-password 246.0 kB 200 kB +46 kB
/reset-password 246.3 kB 200 kB +46 kB
/[workspaceSlug] 241.8 kB 200 kB +42 kB
/[workspaceSlug]/settings 223.0 kB 200 kB +23 kB
/[workspaceSlug]/settings/members 264.8 kB 200 kB +65 kB

Auth pages are the worst offenders and the first pages users see.

Acceptance Criteria

  • /sign-in and /sign-up first-load JS ≤ 200kB gzipped
  • /forgot-password and /reset-password first-load JS ≤ 200kB gzipped
  • /[workspaceSlug] first-load JS ≤ 200kB gzipped
  • /[workspaceSlug]/settings first-load JS ≤ 200kB gzipped
  • /[workspaceSlug]/settings/members first-load JS ≤ 200kB gzipped
  • No visual or functional regressions
  • pnpm lint && pnpm typecheck && pnpm test pass

Dependencies

None

Technical Notes

  • Run pnpm build and inspect .next/diagnostics/route-bundle-stats.json to identify shared chunks
  • Auth pages (286kB) should not import editor, database, or workspace components — check for transitive imports via barrel files
  • @supabase/supabase-js and @sentry/nextjs are likely the largest shared chunk contributors — investigate if these can be tree-shaken or lazy-loaded on non-critical paths
  • Settings/members pages (223-265kB) may eagerly import role-select, invite-form, and member-list — consider next/dynamic for these
  • Workspace home (242kB) may pull in sidebar or page-tree components eagerly — check transitive imports
  • Use npx @next/bundle-analyzer or inspect the build output to identify the largest shared chunks
  • Reference .agents/conventions.md for dynamic import patterns
  • Previous attempts (perf: reduce first-load JS on auth pages below 200kB budget #951, perf: reduce first-load JS on workspace settings and members pages below 200kB budget #952) were closed but sizes remain over budget — review those PRs to understand what was tried and why it didn't stick

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions