Skip to content

TypeScript build is slow, compileOnSave/--watch taking ~1minute #22953

Closed
@bforsythe

Description

@bforsythe

Hi all, first I'll say our team has been big TypeScript fans for a while now (pre-2.x)! But unfortunately, performance issues have been getting rough, and some people on the team are starting to feel that the type safety isn't worth the substantial build time increase (perhaps a little hyperbolic, but it's definitely frustrating).

First off, here's the diagnostic output:

node_modules.bin\tsc -project web/tsconfig.json --diagnostics
Files: 2771
Lines: 205202
Nodes: 934381
Identifiers: 308819
Symbols: 233717
Types: 57830
Memory used: 1191180K
I/O read: 0.91s
I/O write: 0.17s
Parse time: 4.99s
Bind time: 4.46s
Check time: 14.12s
Emit time: 30.09s
Total time: 53.67s

And here's our tsconfig.json:

{
"compileOnSave": true,
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": true,
"module": "none",
"noEmitOnError": true,
"noImplicitAny": false,
"sourceMap": true,
"target": "es5",
"outFile": "./path/to/our/outfile.js",
"declaration": true,
"removeComments": true,
},
"include": [
"Content"
],
"exclude": [
"./path/to/our/outfile.d.ts",
"node_modules"
]
}

Other things worth noting:

  1. We still have a significant amount of .js files in our solution
  2. We are still using namespaces and a single outfile for the vast majority of our files. We have made a small push to start writing modules, but it's pretty painful to mix the two (who loves shim files? No one), and we have too much code to rewrite everything, so it's been slow going.

If there's anymore information I can provide, please let me know, or if you have any thoughts or suggestions we can try, I'd love to hear them! The switch to TS has been the number 1 development/debugging time-saving measure we've made since I've been here. But now it feels like those savings are being reclaimed by the build times :(

Thanks for your help,
Brandon

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptNeeds More InfoThe issue still hasn't been fully clarified

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions