cdk synth --watch re-synthesizes on file changes
Introduced 2026-09-09 · score 0.98
HOW TO USE IT
When iterating on a CDK app, run `cdk synth --watch` to synthesize initially and re-synthesize when watched files change. Configure the project’s `cdk.json` with a `watch` key first.
cdk synth --watchWHY THIS HELPS
When iterating on a CDK app, watch for file changes and regenerate the synthesized output.
REQUIREMENTS AND LIMITATIONS
- Version: 2.1141.0
- --watch (required): Enables watching project files and re-synthesizing on changes.
- cdk.json: watch (required): Project configuration key required by `cdk synth --watch` to set watched files.
- cdk.json: watch.include: Paths to include in watching; accepts a string or array of strings.
- cdk.json: watch.exclude: Paths to exclude from watching; accepts a string or array of strings. `include` and `exclude` are not documented as mutually exclusive.
- Prerequisite: The project’s `cdk.json` must contain a `watch` key; the commit’s integration test configures `watch.include` as `['**/*.ts']`.
FIRST-PARTY EVIDENCE
- https://github.com/aws/aws-cdk-cli/releases/tag/aws-cdk%40v2.1141.0
- https://github.com/aws/aws-cdk-cli/commit/ef24968709532254444d3b868d3ae899a8ffbd1a
- https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-watch.html
Check the installed version and the source before using it. Entry JSON