Repository navigation
Commit 9d84730
fix(docs): load MDX bodies on demand so the Worker fits Cloudflare's 64 MiB limit
`Deploy Docs` has been rejected by the Cloudflare API on every run since
#106 (2026-08-25T21:05Z) with `code: 10027` — the Worker exceeds the 64 MiB
uncompressed limit. Version creation fails, so no new Worker version exists
and the previously accepted one keeps being served: nothing 500s, the site
just stops changing.
The bytes were not the corpus. All 397 `.mdx` files are 2.50 MiB of source;
`handler.mjs` measured 100.93 MiB locally on 94a4126. The multiplier was the
bundling. `fumadocs-mdx:collections/server` imports every page eagerly, so
each server entrypoint that touches `source` — the docs page, and also
`/llms.txt`, `/llms-full.txt`, `/llms.mdx/*`, `/og/*`, `/api/search` and
`/sitemap.xml` — pulled the whole corpus into its own chunk, and the bundler
inlined the set five times over.
Measured on one probe sentence that occurs once, in one English page:
15 copies in `handler.mjs` before, 6 after. `async: true` on the docs
collection makes each page's compiled body a dynamic import, so Turbopack
emits per-page chunks (27 chunk files before, 971 after) instead of one
corpus-sized chunk per entrypoint.
handler.mjs 100.93 MiB -> 48.47 MiB (-52.0%)
The only consumer this changes is the docs page, which now awaits
`page.data.load()` for `body` and `toc`. Frontmatter stays eager, so
`title`, `description`, `seoTitle` and `full` are untouched, and
`getText('processed')` — what the llms.txt routes call — remains a method on
the entry, so the generated `llms` bodies are byte-identical.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GkauAsZBEemRbco2rEX9Lx1 parent 94a4126 commit 9d84730
2 files changed
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
283 | 287 | | |
284 | 288 | | |
285 | 289 | | |
286 | | - | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
8 | 31 | | |
9 | 32 | | |
10 | 33 | | |
| |||
0 commit comments