basarat
basarat

Reputation: 276323

How can I speed up initial TypeScript compile times

I have a fairly big TypeScript project (200+ files) and it takes some time (10s+) to boot up when I run it in watch mode (tsc --watch). However once its going it is pretty fast to do a full typecheck TypeScript.

How can I speed up the initial boot of tsc --watch?

Upvotes: 12

Views: 16014

Answers (1)

basarat
basarat

Reputation: 276323

TypeScript 3.4 rc got the --incremental compiler option (blog post).

When it is enabled TypeScript will generate a .tsbuildinfo file if there isn't one already (so you still play the 10s+ penalty once). But if it exists, a cold tsc --watch run will be super fast (no longer 10s delay).

How to enable incremental builds

Either with command line flag --incremental or in your tsconfig.json:

{
    "compilerOptions": {
        "incremental": true
    }
}

Upvotes: 19

Related Questions