Typescript: Compile on save stop working after typescript v2.1.5 in Visual Studio 2015

Created on 8 Apr 2017  路  11Comments  路  Source: microsoft/TypeScript

TypeScript Version: 2.2.2 for Visual Studio 2015, downloaded from http://download.microsoft.com/download/6/D/8/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA/TS-2.2-dev14update3-20170321.1/TypeScript_Dev14Full.exe

tsconfig.json

{
    "compileOnSave": true,
    "compilerOptions": {
        "baseUrl":  "Scripts/app",
        "noImplicitAny": false,
        "noEmitOnError": true,
        "removeComments": true,
        "sourceMap": true,
        "module": "commonjs",
        "target": "es5"
    },
    "exclude": [
        "node_modules"
    ]
}

Expected behavior:

js file should be generatedupdated on each ts file change.

Actual behavior:

  • js files generatingupdating only on web project buildrebuild.
  • If remove typescript 2.2.2 and install typescript 2.1.5 - all working fine and js files generatingupdating on each ts file change.

On our project this behaviour actual for all developers(they have different windows os and other visual studio settings, Update 3 installed on all machines) who update typescript to 2.2.2 version.

Bug Fixed

Most helpful comment

TS 2.3.3 should be available today.

All 11 comments

I am also seeing this.
After TypeScript Tools for Visual Studio 2015 2.1.5, "compileOnSave" no longer works for any developer on my team.

I tried 2.2.0, 2.2.1, 2.2.2 and 2.3.0
Is there another work around besides downgrading?
Having to buildrebuild to get the js files in sync is cumbersome at best.

Still doesn't work with TypeScript Tools for Visual Studio 2015 2.3.1.

@IvanYur4enk0 : Thanks for flagging this. I'm trying to repro using VS2015 Update 3 with the TS 2.2.2 install that you linked to above. I've put your tsconfig.json at the project root level and a scriptsApp folder that contains two .ts files. Compile On Save is working correctly for me so there must be something different about our project setup. The only time it doesn't Compile On Save is when there are TS errors in the Error List (this is by design). I'll attach a screenshot of my test. Can you take a look and see if the set up looks different than yours (ex: location of .ts files or tsconfig.json). Also can you confirm that there are no errors in the error list when you save and that other language service features are working correctly (ex: completions & navigation bar). I'd also be curious to know if you're seeing 3 dropdowns in the nav bar or only 2?

(BTW: the generated js files are hidden by default in the solution explorer. Sometimes I have to toggle the _Show All Files_ button for them to show up
compileonsave

@jramsay thank you for answer,

Also can you confirm that there are no errors in the error list when you save and that other language service features are working correctly (ex: completions & navigation bar)

Yes, I can confirm that no errors in solution and js files are generating correctly with the same source code using buildrebuild, only compile on save is not working.

Completions and navigation bar are also working correctly.

I'd also be curious to know if you're seeing 3 dropdowns in the nav bar or only 2

I can see 3 dropdowns.

Maybe this problem is related with this issue.

I can see the same errors in Errors -> Intellisense while typing code in VS. And the problem appeared after typescript 2.1.5.

Severity    Code    Description Project File    Line    Suppression State

Error   TS5055  Cannot write file '{Project Path}/node_modules/jquery/dist/jquery.js' because it would overwrite input file.    TypeScript Virtual Projects     1   Active

Error   TS5055  Cannot write file '{Project Path}/node_modules/lodash/lodash.js' because it would overwrite input file. TypeScript Virtual Projects     1   Active

{and the same errors with other imported libraries}

@jramsay, sample uploaded: 15083_Sample.zip.

Steps to reproduce:

  1. Install npm dependencies.
  2. Open TestTypeScriptCompileOnSave.sln solution.
  3. Rebuild solution -> sources compiling without errors, js file generated with valid content.
  4. Try to modify "Scriptsapptest1.ts", for example change alert('8') to alert('9') -> compile on save is not working. No build errors, 1 intellisense error:
Error   TS5055  Cannot write file '{Project Path}/node_modules/lodash/lodash.js' because it would overwrite input file. TypeScript Virtual Projects     1   Active
  1. Try to BuildRebuild web project -> sources compiling without errors, js file generated with valid content.

@IvanYur4enk0: so nice to get a repro project - thanks! I'm seeing the same behavior now. Will take a look and see what is happening.

I tested with Visual Studio 2015 and "2.3.3-insiders.20170512" build or typescript, and it fixed my problem. Will there be a official release of 2.3.3, or do i wait for 2.4?

Of course since the latest release of Typescript for Visual Studio 2015 is stuck at version 2.3.1, i had to hot swap in the typescriptServices.js from the insiders build to get Visual Studio to behave.

TS 2.3.3 should be available today.

I'm using the 'Typescript Build' option for a 'traditional' ASP.NET project and something strange is going on with 2017 and it isn't just the typescript version installed.

If on Ctrl+S you don't get the generated file I've noticed that restarting VS2017 can fix this issue. I was working all weekend on something and never noticed an issue and then suddenly it started playing up - no errors but no 'Output(s) generated successfully.' message either. Restart of the IDE fixed it.

@simeyla solution worked for me. thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlaberge picture dlaberge  路  3Comments

Zlatkovsky picture Zlatkovsky  路  3Comments

uber5001 picture uber5001  路  3Comments

blendsdk picture blendsdk  路  3Comments

jbondc picture jbondc  路  3Comments