Cities Cities - 20 days ago 14
AngularJS Question

Intellij constantly compiles TypeScript (very slow) - How to stop this behavior?

I am in the process of migrating an Angular 1.x project from vanilla JS to TypeScript. However, I am experiencing extremely slow response times from my IDE.Constant compiling of many files

If I uncheck "Track changes" in Settings > Languages & Frameworks > TypeScript, the compilation stops--but I am then in a position where my TS doesn't compile!

Of course, I could configure a gulp file and set a watcher that recompiles files on change. But, if possible, I would like to avoid the need to run gulp for each project. Also, more importantly, unchecking "Track changes" removes TS specific advice AND appears to break some references.

Track changes: Checked - Help + references
Help + References

Track changes: Unchecked - No help + References broken
No help + References broken

Question #1:

Is it possible to configure Intellij such that it only compiles changed files?

Question #2:

Why is Intellij compiling so many files?
Here is a copy of my tsconfig.json:

{
"compilerOptions": {
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "build/local/tsc.js",
"sourceMap": true,
"typeRoots": [
"./node_modules/@types",
"./typings"
],
"moduleResolution": "node"
},

"exclude": [
"client/src/node_modules",
"**/*.spec.ts",
"src/bower_components",
"client/src/bower_components",
"client/src/node_modules",
"build",
"Saved_HTML",
"site-ideas",
"node_modules",
"client/typings"
]
}


Note that despite setting node_modules as an ignored directory, the compiler is still reaching in there. enter image description here.

Answer

Question 1:

IntelliJ saves files pretty frequently. Typescript compiles when a file is saved. Therfore, you should disable or limit autosave.

Question 2:

I dont know why excluding files doesn't work for you, but I suggest rather to include "rootDir": "./yourSourceDir" than exclude other files.

Comments