Watch command sees built files as changes to rebuild

This issue has been tracked since 2023-02-23.

Search terms

  • watch
  • change detection
  • rebuild

Expected Behavior

When in "watch" mode, I'd expect Typedoc to only rebuild files when a source file has been added, deleted or modified.

Actual Behavior

When in "watch" mode Typedoc repeatedly rebuilds on loop.

Steps to reproduce the bug

I have created an example here: https://stackblitz.com/edit/node-cwq1z6
run npx typedoc --watch to see the problem.

Environment

  • Typedoc version: 0.23.25
  • TypeScript version: 4.9.5
  • Node.js version: 16.14.2
  • OS: macOS Monterey 12.6.3
Gerrit0 wrote this answer on 2023-03-05

Your tsconfig.json isn't set up correctly.

  "includes": ["src"]

This isn't the property that TypeScript recognizes to specify which files are included, that's include, so TypeScript will look at every single file in the current directory. You can see this by running npx tsc --explainFiles

❯ npx tsc --explainFiles --noEmit
(many lines omitted)
  Matched by default include pattern '**/*'

Because the docs folder is matched by this pattern, TS will notice that a file changes in there when the watch fires and tell us something changed, so TypeDoc will rebuild... resulting in the infinite loop you saw.

Two possible fixes:

  1. Fix includes, renaming it to include
  2. Add "exclude": ["docs"]
johngeorgewright wrote this answer on 2023-03-05

Ah, silly mistake. Thank you.

More Details About Repo
Owner Name TypeStrong
Repo Name typedoc
Full Name TypeStrong/typedoc
Language TypeScript
Created Date 2014-05-24
Updated Date 2023-03-19
Star Count 6487
Watcher Count 68
Fork Count 639
Issue Count 48

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date