Skip to content

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

ItemDetail
MessageModule not found: Can't resolve '@/lib/get-dictionary'
Typical causeRoot .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

ItemDetail
MessageModule not found for apps/client-web/lib/utils/*.ts
Typical causeFiles 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-web in this monorepo).
  • Wrangler config filename varies by package: use wrangler.jsonc or wrangler.toml next to the project — align build output with the Pages project’s Output directory.

Local verification tips

  • Run the same pnpm / next build command locally as CI.
  • If next-on-pages or Wrangler dev is used, confirm the generated output directory matches Pages configuration.
Help