TypeStrong / fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type check is slow in incremental mode on watch mode's subsequent runs (not on the first run).

EugeneGarbuzovPublic opened this issue · comments

Current behavior

Type check is slow in incremental mode on watch mode's subsequent runs (not on the first run).

Expected behavior

Type check in incremental mode on watch mode's subsequent runs (not on the first run) has the same or comparable performance as in non-incremental mode.

Steps to reproduce the issue

  1. Set "incremental": true in tsconfig.
  2. Set build: true, mode: 'write-references' in fork-ts-checker options, as in the guide.
  3. Run pnpm start.
  4. After compilation and type check finish, modify src/index.tsx (e. g. add an empty comment) and save file.
  5. Note that after watch mode recompilation fork-ts-checker's type check finishes in approximately 2 seconds after compilation finishes. You may modify and save src/index.tsx multiple times to make sure.
  6. Stop pnpm start process.
  7. Remove "incremental": true from tsconfig, build: true, mode: 'write-references' from fork-ts-checker options.
  8. Repeat steps 3-4.
  9. Note that after watch mode recompilation fork-ts-checker's type check finishes within some milliseconds after compilation finishes. It looks as if it's almost immediate. You may modify and save src/index.tsx multiple times to make sure. Compare that to the results of step 5.

Please note that such a small value of 2 seconds is only on the reproduction repository. On a real-life project type check ends 35 seconds after compilation ends. After every file save.
At the same time without incremental mode type check finishes within a couple of seconds after compilation ends.

Is that the expected behaviour of incremental mode? Or is it a bug?

Issue reproduction repository

https://github.com/EugeneGarbuzovPublic/slow-incremental

Environment

  • fork-ts-checker-webpack-plugin: 9.0.2
  • typescript: 5.3.3
  • eslint: 8.56.0
  • webpack: 5.89.0
  • os: Windows 11 Pro 22H2 22621.2861