Skip to content

fix: prevent empty Vite 8 stats from breaking the build#184

Merged
Boshen merged 1 commit into
mainfrom
fix-vite-stats-empty-data
Jun 7, 2026
Merged

fix: prevent empty Vite 8 stats from breaking the build#184
Boshen merged 1 commit into
mainfrom
fix-vite-stats-empty-data

Conversation

@Boshen

@Boshen Boshen commented Jun 7, 2026

Copy link
Copy Markdown
Member

Problem

The Update Vite Stats workflow (failing run) runs vp run generatevp check --fix. Since commit bf33f4a, tools/override-vite.mjs targets stable Vite 8 releases (/^8\.\d+\.\d+$/). No stable Vite 8 exists on npm yet, so generate writes an empty [] to data/vite-version-stats.json. With an empty array, TypeScript infers the JSON import as never[], so every stat.version / stat.buildTime access fails (Property 'X' does not exist on type 'never') and vp check errors out.

Fix

  • Add typed wrapper apps/dashboard/src/data/viteStats.ts that casts the JSON to ViteStat[], so empty data type-checks instead of collapsing to never[].
  • Repoint all four importers (BuildTimeChart, BundleSizeChart, StatsCards, ViteStatsPage) at the typed module.
  • Skip writing the stats file when no versions are collected, so existing tracked data isn't clobbered until Vite 8 ships. Picks up Vite 8 automatically once released.

Verified vp check and vp run build pass, including a simulated empty-data ([]) run.

No stable Vite 8 release exists yet, so the stats generator wrote an
empty array to data/vite-version-stats.json, which TypeScript infers as
never[] and breaks every chart component (vp check failure in the Update
Vite Stats workflow).

- Add a typed apps/dashboard/src/data/viteStats.ts wrapper so empty data
  type-checks as ViteStat[] instead of never[]
- Point all stats importers at the typed module
- Skip writing the stats file when no versions are collected so existing
  tracked data isn't clobbered until Vite 8 ships
@Boshen Boshen merged commit fb8f058 into main Jun 7, 2026
5 checks passed
@Boshen Boshen deleted the fix-vite-stats-empty-data branch June 7, 2026 04:05
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