Skip to content

Slow compilation issues (40-50s) - --skipLibCheck not working #41517

Closed
@NoPhaseNoKill

Description

@NoPhaseNoKill

TypeScript Version: 3.8.3

Search Terms: --skipLibCheck slow compilation tsc

Code

Running tsc --listFiles --generateCpuProfile profile --skipLibCheck from the command line results in having the following output - which appears to be slowing compilation significantly. It appears as though it's including multiple .d.ts files from my @types node_modules in the compilation. What sort of time should I be expecting this amount of files to compile in? Any help reducing the compilation time would also be greatly appreciated.

/home/user1/projects/projectName/node_modules/@types/semantic-ui-form/global.d.ts
/home/user1/projects/projectName/node_modules/@types/jquery/JQueryStatic.d.ts
/home/user1/projects/projectName/node_modules/@types/moment-timezone/moment-timezone.d.ts
.....etc

Extended diagnostics are:
Files:                         3022
Lines:                       410050
Nodes:                      1604064
Identifiers:                 555657
Symbols:                     804555
Types:                       254555
Memory used:               1220647K
Assignability cache size:     95587
Identity cache size:          13620
Subtype cache size:         4718477
Strict subtype cache size:     6378
I/O Read time:                0.10s
Parse time:                   1.78s
Program time:                 3.22s
Bind time:                    1.45s
Check time:                  39.98s
transformTime time:           1.39s
commentTime time:             0.56s
I/O Write time:               0.20s
printTime time:               5.02s
Emit time:                    5.02s
Total time:                  49.68s
 

my tsconfig is as follows:

{
  "compilerOptions": {
    "outDir": "./dist/",
    "extendedDiagnostics": true,
    "baseUrl": "src/",
    "module": "commonjs",
    "target": "es6",
    "jsx": "react",
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "lib": [
      "dom",
      "es2015",
      "scripthost",
      "es6",
      "es2016",
      "es2017"
    ]
  },
  "include": [
    "./src/**/*.ts",
    "./src/**/*.tsx"
  ],
  "exclude": [
    "node_modules",
    ".idea",
    ".storybook",
    ".git",
    "dist"
  ]
}

with my project folder structure being:

├── src
│   ├── folder1/....
│   └── folder2/.....
├── node_modules
│   ├── shouldNotBeCompiled1.d.ts
│   ├── shouldNotBeCompiled2.d.ts
│   └── shouldNotBeCompiled3.d.ts
├── dist

Expected behavior:
Should not type-check any of the files inside node_modules during compilation
Actual behavior:
Appears to be including node_modules/@types during compilation - which is causing a compilation time of ~50s for project.

Related Issues:
#37635
#36103

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions