TypeScript: Compile on Build / Compile on Save problems with TS 1.8 in Visual Studio 2015
Since I installed TS 1.8 I’ve started noticing that the compile step is not being executed in Visual Studio either on save or upon build when there are existing *.js files in place.
So if I’m working on viewModel.ts then I need to delete viewModel.js and trigger a Visual Studio build in order that a new viewModel.js is created.
My tsconfig.json looks like this:
{
"compileOnSave": false,
"compilerOptions": {
"inlineSourceMap": true,
"inlineSources": true,
"noEmitOnError": true,
"noImplicitAny": true,
"preserveConstEnums": true,
"removeComments": false,
"sourceMap": false,
"target": "es5"
},
"filesGlob": [
"**/*.ts"
],
"files": [
// lots of files here - excluded for brevity
],
"atom": {
"rewriteTsconfig": true
}
}
I wondered if it might be related to presence of the compileOnSave flag in tsconfig.json (which I believe is supported as of TS 1.8?). However setting it to true and removing it entirely made no discernible differerence to behaviour. (I tried closing and reopening the project in between changes in case there were caching issues but no change.)
So compileOnSave seems entirely broken (i.e. it never compiles on save) and compile on build only works if the existing js files are deleted.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 36 (16 by maintainers)
Here’s what I don’t get: it sometimes works fine and others it doesn’t!
I can’t for the life of me figure out what I’m doing right or wrong when, or if I even have any influence on this at all. It’s almost more frustrating to have it work “sometimes” than to just never work.
My workaround sucks. Today, it simply doesn’t work so I am back to the habit of hitting “Rebuild” every time I make the tiniest change. Please tell me you’ve found a better temporary workflow/workaround until this is fixed!!!
But yesterday it was all unicorns and rainbows. Everything was flowing beautifully in the same solution, same IDE, same computer. No idea what changed. If it works sometimes, maybe there’s a tweak to get it to work always?
and hello @cmichaelgraham, good to see you!
& hello again @mhegazy 😄
the
compileOnSaveproperty support is not in a released version yet, @paulvanbrenk checked it in today 😃. it should be available for the 1.8.2.Can you check your tools\options\Text Editor\TypeScript\Project\Compile on Save, do you have “Automatically compile TypeScript files that are not part of a project” checked? my guess is no, and that is why it is not working. with #2326, you should be able to turn it on using
compileOnSaveproperty in tsconfig.json.