When I run tsc with a project file (tsconfig.json) it takes a very long time (>1 minute) to finish. When I specify the same arguments on the command line or in an arguments file it finishes within seconds. This happens on Mac OS with typescript 2.7.2
This is the tsconfig.json that I use:
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true
}
}
When I time it using the time command I get the following result:
> time tsc --diagnostics -p tsconfig.json
Files: 38
Lines: 34429
Nodes: 157429
Identifiers: 52565
Symbols: 50844
Types: 12929
Memory used: 86147K
I/O read: 0.02s
I/O write: 0.01s
Parse time: 0.64s
Bind time: 0.44s
Check time: 1.91s
Emit time: 0.19s
Total time: 3.19s
real 2m20.611s
user 0m34.914s
sys 1m11.042s
It takes more than 2 minutes.
When I create an arguments file that looks like this:
--target es2017 --module commonjs --outDir dist --sourcemap
And time the command:
> time tsc --diagnostics @args src/*
Files: 38
Lines: 34429
Nodes: 157429
Identifiers: 52565
Symbols: 50844
Types: 12929
Memory used: 83773K
I/O read: 0.00s
I/O write: 0.00s
Parse time: 0.52s
Bind time: 0.24s
Check time: 1.10s
Emit time: 0.09s
Total time: 1.96s
real 0m2.259s
user 0m3.568s
sys 0m0.133s
Now it only takes 2 seconds, but I don't expect to see a significant difference, because I run typescript with the exact same options. Am I overlooking something?
If you have a nested directory structure, it should be src/**/* and not src/*
or use tsc @args --sourceRoot src
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With