Skip to content

feat: show Rspress compilation progress in dev TUI loading state #100

Description

@zrosenbauer

Summary

When zpress dev starts, the TUI shows a generic "Starting dev server..." spinner during the Rspress compilation phase. On larger projects this phase can take several seconds, but the user gets no feedback about what's happening — it appears hung.

The TUI should surface Rspress/Rsbuild compilation progress so users know the server is actively working, not stuck.

Current state

The dev screen (packages/cli/src/screens/dev-screen.tsx) has three phases:

  • loading — shows <Spinner label="Starting dev server..." /> (~line 260-267)
  • ready — full TUI with activity log, stats, hotkeys
  • error — error alert

The loading phase covers the entire init() flow (~lines 93-191): config loading, initial sync, and startDevServer(). There's no breakdown — a 1-second sync and a 10-second Rspack compilation both show the same static spinner.

Additionally:

  • There is no timeout on init() — if sync or Rspress hangs, the spinner shows forever with no escape
  • startDevServer() in packages/cli/src/lib/rspress.ts (~line 77) calls dev() which returns only after compilation completes — no progress callbacks are surfaced
  • Rsbuild's progressBar is explicitly disabled (~line 111) since the TUI renders its own status, but nothing replaces it

Proposed scope

  1. Break loading into sub-phases — show distinct messages:

    • "Loading config..."
    • "Syncing content..." (with page count when available)
    • "Compiling..." (Rspress/Rspack phase)
  2. Surface Rsbuild compilation progress — Rsbuild exposes onAfterDevCompile and build hooks. Consider using rsbuild.onAfterCreateCompiler or rspack's ProgressPlugin to report percentage back to the TUI.

  3. Add a timeout — if init doesn't complete within a reasonable window (e.g., 60s), show a warning or allow the user to quit cleanly instead of hanging forever.

Location

  • packages/cli/src/screens/dev-screen.tsxinit() function (~lines 93-191), loading phase render (~lines 259-267)
  • packages/cli/src/lib/rspress.tsstartDevServer() (~line 77), startServer() (~line 85)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions