Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Configure and optimize Turborepo monorepo build pipelines with correct task structure, caching, and CI setup.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/watch/RULE.md
1# turbo watch23Full docs: https://turborepo.dev/docs/reference/watch45Re-run tasks automatically when code changes. Dependency-aware.67```bash8turbo watch [tasks]9```1011## Basic Usage1213```bash14# Watch and re-run build task when code changes15turbo watch build1617# Watch multiple tasks18turbo watch build test lint19```2021Tasks re-run in order configured in `turbo.json` when source files change.2223## With Persistent Tasks2425Persistent tasks (`"persistent": true`) won't exit, so they can't be depended on. They work the same in `turbo watch` as `turbo run`.2627### Dependency-Aware Persistent Tasks2829If your tool has built-in watching (like `next dev`), use its watcher:3031```json32{33"tasks": {34"dev": {35"persistent": true,36"cache": false37}38}39}40```4142### Non-Dependency-Aware Tools4344For tools that don't detect dependency changes, use `interruptible`:4546```json47{48"tasks": {49"dev": {50"persistent": true,51"interruptible": true,52"cache": false53}54}55}56```5758`turbo watch` will restart interruptible tasks when dependencies change.5960## Limitations6162### Caching6364Caching is experimental with watch mode:6566```bash67turbo watch your-tasks --experimental-write-cache68```6970### Task Outputs in Source Control7172If tasks write files tracked by git, watch mode may loop infinitely. Watch mode uses file hashes to prevent this but it's not foolproof.7374**Recommendation**: Remove task outputs from git.7576## vs turbo run7778| Feature | `turbo run` | `turbo watch` |79| ----------------- | ----------- | ------------- |80| Runs once | Yes | No |81| Re-runs on change | No | Yes |82| Caching | Full | Experimental |83| Use case | CI, one-off | Development |8485## Common Patterns8687### Development Workflow8889```bash90# Run dev servers and watch for build changes91turbo watch dev build92```9394### Type Checking During Development9596```bash97# Watch and re-run type checks98turbo watch check-types99```100