watch
Re-run tasks in your repository, based on code changes.
turbo watch
is dependency-aware, meaning tasks will re-run in the order configured in turbo.json
.
Using turbo watch
with persistent tasks
When your script has a built-in watcher, you likely don't need to use turbo watch
. Instead, use your script's built-in watcher and mark the task as long-running using "persistent": true
.
Persistent tasks will continue to run as usual with turbo watch
, allowing persistent and non-persistent tasks to be run at the same time.
Limitations
Task outputs
If you have tasks that write to files checked into source control, there is a possibility that Watch Mode will run in an infinite loop. This is because Watch Mode watches your files for changes and will re-run tasks in packages that have changed. If a task creates a change, then that will trigger the task again.
Watch Mode has some logic to prevent this from happening using file hashes, but it isn't foolproof. To avoid this issue, we recommend removing any task outputs from git.
Was this helpful?