-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
Problem
When using code generators like paraglide-js
(i18n), graphql-codegen
, or prisma
, wrangler's custom build watch triggers infinite rebuild loops because generated files are detected as changes.
Current Behavior
[build]
command = "pnpm build"
watch_dir = "src"
What happens:
- Build generates files in
src/lib/paraglide/
- Wrangler detects file changes in
watch_dir
- Triggers rebuild
- Build generates files again
- Infinite loop 🔄
Additionally:
.gitignore
patterns are not respected by watch- No way to exclude subdirectories from watch
Proposed Solution
Option 1: Add watch_ignore
parameter
[build]
command = "pnpm build"
watch_dir = "src"
watch_ignore = ["src/lib/paraglide/**", "**/.svelte-kit/**"]
Option 2: Automatically respect .gitignore
Wrangler should automatically exclude paths listed in .gitignore
from the watch mechanism.
Use Cases
This affects any project using code generators:
- i18n:
paraglide-js
,typesafe-i18n
- GraphQL:
graphql-codegen
- ORM:
prisma client generate
- Type generation:
openapi-typescript
- Build artifacts:
.svelte-kit
,.next
, etc.
Current Workaround
Users must manually run build before dev:
pnpm build && pnpm wrangler dev --port 8788
This removes the benefit of automatic rebuilds on file changes.
Related Issues
- Prevent custom builds from executing concurrenctly #10944 - Prevent custom builds from executing concurrently
Environment
- wrangler: 4.42.2
- Framework: SvelteKit
- Adapter: @sveltejs/adapter-cloudflare
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Untriaged