TypeStrong / fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.
MIT License
1.93k stars 238 forks source link

Incremental mode is not working in webpack devServer #800

Open Clarkkkk opened 1 year ago

Clarkkkk commented 1 year ago

Current behavior

Every time I run npm start, type checking for the first time costs over 40s. It seems incremental mode is not working. Is it a bug?

fork-ts-checker-webpack-plugin settings in webpack.config.js

new ForkTsCheckerWebpackPlugin({
    async: true,
    typescript: {
        memoryLimit: 4096,
        build: true,
        mode: 'write-references',
        profile: true
    }
}),

tsconfig.json

{
    "compilerOptions": {
        "incremental": true,
        "target": "esnext",
        "module": "commonjs",
        "allowJs": true,
        "jsx": "react-jsx",
        "outDir": "build/dist",
        "removeComments": true,
        "importHelpers": true,
        "strict": true,
        "strictNullChecks": true,
        "noImplicitThis": true,
        "alwaysStrict": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "noImplicitReturns": true,
        "noFallthroughCasesInSwitch": true,
        "moduleResolution": "node",
        "baseUrl": "./",
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "inlineSourceMap": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "forceConsistentCasingInFileNames": true,
        "skipDefaultLibCheck": true,
        "skipLibCheck": true,
        "allowUnreachableCode": true
    },
    "include": [
        "src"
    ],
    "exclude": [
        "node_modules",
        "**/*.test.ts",
        "**/*.test.tsx",
        "build",
        "public"
    ]
}
fork-ts-checker-webpack-plugin profile (index) Values
I/O Read 734.4649001657963
Parse 2673.0942985117435
ResolveModule 19378.75139886141
ResolveTypeReference 16.45439985394478
Program 23863.12950000167
Bind 1626.3879010379314
Check 39361.3742005229
transformTime 1613.7538009285927
printTime 6509.613999992609
Emit 6510.059900015593
I/O Write 4445.8865012824535
tsc profile (tsc --noEmit --watch --diagnostics --preserveWatchOutput) Files 7363
Lines 586774
Nodes 3329920
Identifiers 809973
Symbols 446776
Types 82
Instantiations 0
Memory used 1005665K
I/O read 0.57s
I/O write 0.00s
Parse time 10.29s
Bind time 1.43s
Check time 0.00s
Emit time 0.00s
Total time 11.72s
tsc profile (with --incremental false) Files 736
Lines 58677
Nodes 332992
Identifiers 80997
Symbols 99669
Types 37187
Instantiations 427130
Memory used 1779242
I/O read 0.69
I/O write 0.00
Parse time 10.91
Bind time 1.45
Check time 36.18
Emit time 0.00
Total time 48.54

Expected behavior

Time for type checking should be roughly the same as tsc.

Steps to reproduce the issue

The repository is private, but if you need a reproduction, I may find another repository to do it.

Environment