Skip to content

Commit e3deea6

Browse files
nh2chenjiahan
andauthored
README: No longer recommend TypeScript Build mode for incremental (#60)
Co-authored-by: neverland <jait.chen@foxmail.com>
1 parent cd88aae commit e3deea6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,11 @@ setting "generateTrace" compiler option. This is an instruction from [microsoft/
247247

248248
## Enabling incremental mode
249249

250-
You must both set `"compilerOptions.incremental": true` in your `tsconfig.json` and also specify `build: true` in `TsCheckerRspackPlugin` settings.
250+
TypeScript's "incremental" mode speeds up initial cold-start typechecks keeping an on-disk cache.
251251

252-
- `tsconfig.json`:
252+
It does not speed up subsequent subsequent re-typechecking during the runtime of the dev server.
253+
254+
To enable incremental mode, set `"compilerOptions.incremental": true` in your `tsconfig.json`:
253255

254256
```diff
255257
{
@@ -259,7 +261,9 @@ You must both set `"compilerOptions.incremental": true` in your `tsconfig.json`
259261
}
260262
```
261263

262-
- `TsCheckerRspackPlugin` settings:
264+
In the past we also recommended to combine incremental mode with specifying `build: true` in `TsCheckerRspackPlugin` settings to enable TypeScript's ["Build" mode](https://www.typescriptlang.org/docs/handbook/project-references.html#build-mode-for-typescript) designed to handle [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html#build-mode-for-typescript).
265+
266+
However, "Build" mode causes significant slowdowns for re-typechecks when the dev server is already running, as it switches from TypeScript's in-memory "Watch" mode to "Build" mode. If you need "Build" mode, it can be configured as:
263267

264268
```js
265269
new TsCheckerRspackPlugin({

0 commit comments

Comments
 (0)