diff --git a/apps/docs/scripts/postbuild.mjs b/apps/docs/scripts/postbuild.mjs index f161460..04fecb3 100644 --- a/apps/docs/scripts/postbuild.mjs +++ b/apps/docs/scripts/postbuild.mjs @@ -2,7 +2,7 @@ // static-asset serving expects `index.html` both for `/` and as the single-page-app // fallback (`not_found_handling: "single-page-application"`). Materialize the shell as // index.html so the home route and client-side navigation both resolve on Workers. -import { copyFileSync, existsSync, readdirSync, rmSync, writeFileSync } from "node:fs"; +import { copyFileSync, existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { dirname, relative, resolve } from "node:path"; import { fileURLToPath } from "node:url"; @@ -54,7 +54,19 @@ function toLocation(indexHtmlPath) { return `${SITE_ORIGIN}/${route}`; } -const locations = findIndexHtmlPaths(publicDir).map(toLocation).toSorted(); +const indexHtmlPaths = findIndexHtmlPaths(publicDir); + +// Guard against silently truncated prerenders: a complete page ends with ``, and the +// hydration-bootstrap