Cloudflare Pages — client-web module not found
This runbook merges former planning notes about Module not found failures during Cloudflare Pages builds for apps/client-web. Pages clones Git; anything not committed (or ignored by .gitignore) is absent in CI.
Symptom A — @/lib/get-dictionary
| Item | Detail |
|---|---|
| Message | Module not found: Can't resolve '@/lib/get-dictionary' |
| Typical cause | Root .gitignore contains a broad lib/ rule, so apps/client-web/lib/ is never committed. Local builds succeed because the folder exists on disk. |
Fix (preferred): add a negation rule so apps/client-web/lib/ is tracked (for example !apps/client-web/lib/ after the lib/ ignore), then git add and push. See monorepo root .gitignore and apps/client-web/scripts/lib/** policy in the monorepo AGENTS.md for the current exception pattern.
Alternative: rename lib/ under the app and update tsconfig paths and imports (larger change).
Symptom B — @/lib/utils/detect-language or date-formatter
| Item | Detail |
|---|---|
| Message | Module not found for apps/client-web/lib/utils/*.ts |
| Typical cause | Files never pushed, or ignored by .gitignore. |
Fix: ensure apps/client-web/lib/utils/detect-language.ts and apps/client-web/lib/utils/date-formatter.ts exist in Git, then push. Verify locally with pnpm run build from the app (see apps/client-web/README.md).
Pages / Wrangler settings (sanity check)
- Root directory must match where Next runs (usually
apps/client-webin this monorepo). - Wrangler config filename varies by package: use
wrangler.jsoncorwrangler.tomlnext to the project — align build output with the Pages project’s Output directory.
Local verification tips
- Run the same
pnpm/next buildcommand locally as CI. - If
next-on-pagesor Wrangler dev is used, confirm the generated output directory matches Pages configuration.
Related
- Cloudflare Pages integration
- Monorepo
AGENTS.md— client-web verify scripts and dictionary tooling.