Commit 7580505
build(ssg): add post-build crawler for content prerender
Vike's native prerender emitted per-route HTML shells but the React tree
was empty in each (client-only Page, no SSR). Crawlers that don't run JS
— Slack link previews, DuckDuckGo, Bing's older bot, archive.org — saw
blank bodies despite correct head metadata.
Add scripts/prerender-crawl.mjs: boots Vite preview in-process, drives
Puppeteer through all 140 static routes in parallel, captures each
rendered #react-root and inlines it into the corresponding HTML file.
Refreshes 404.html from the crawled home as the SPA fallback.
Skipped routes (slow/empty render within 10s) keep their empty shell and
are not a build failure. One current skip: /sitemap.
npm run build = vite build + shell 404 + crawler (~1–2 min)
npm run build:fast = vite build + shell 404 only (for quick iter)
Result: content pages now ship 50 KB – 750 KB of real rendered HTML
per route instead of a 3.6 KB shell.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 4ae4453 commit 7580505
4 files changed
Lines changed: 198 additions & 88 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments