Too many items generated in `_route.json` for cloudflare preset
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Environment
/
Reproduction
Run playground from repo unsing
NITRO_PRESET=cloudflare_pages nr dev:build
Describe the bug
Actually, the preset use a glob to add every files from the public directory https://github.com/unjs/nitro/blob/main/src/presets/cloudflare-pages.ts#L113. This can easily generate more than 100 paths, limit from Cloudflare, https://developers.cloudflare.com/pages/functions/routing/#limits.
Could we add a flag to generate global path like '/assets/', '/images/' and so on?
related to https://github.com/nuxt-modules/og-image/issues/77
related to https://github.com/unjs/website/pull/228#issuecomment-1884945571
Additional context
No response
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/presets/cloudflare-pages.ts around the referenced glob at line 113, then run the playground command with NITRO_PRESET=cloudflare_pages nr dev:build. Trace how public files become _route.json entries and define what grouped wildcard paths should look like; done means the generated routes stay within Cloudflare Pages' limit while preserving public asset routing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100