1

I have Visual Studio and am using it to build my typescript project. I have one build.ts file that links to all my other TS files and they are all compiled to one app.js file (with an associated map file).

The build apparently works fine but if the js file is already there it is not updated. If I delete the js file and build it is created no problem, it is only a problem if the js file is already there. The js file is NOT read only.

I have solved this by adding a call to tsc in my prebuild event command line - this works fine. This does not seem ideal though as I have to have my build configuration setup in 2 different places. When I moved to Typescript 1.5 I got all sorts of odd errors as VS was on 1.5 but my build command was on 1.4.

I can live with the workaround but it seems like a fairly major failing by VS that it doesn't actually update my compiled output.

Roaders
  • 4,373
  • 8
  • 50
  • 71
  • 2
    Honestly, as much as I tried to make a visual studio workflow work for me, it just is not set up for handling typescript compilation well. I'd seriously consider trying Gulp. – Zachary Dow Aug 21 '15 at 13:25
  • @Roaders could you please set build vervosity to detailed and take a look in output window at executed tsc command? – Artiom Aug 21 '15 at 14:56
  • @ZacharyDow ...and TS and VS are both from Microsoft and even then they did an epic fail! What a shame! – Elisabeth Mar 02 '16 at 08:45
  • @Elisabeth To be fair, Typescript is amazing beyond the compilation process. Yeah Microsoft dropped the ball a bit, but you can't stay mad at them when you have such good tools in place. :) – Zachary Dow Mar 02 '16 at 13:53
  • Well look at atom IDE that offers great TS support! – Elisabeth Mar 02 '16 at 20:53
  • I use atom at home, don't have a choice at work. – Roaders Mar 02 '16 at 20:53

2 Answers2

2

Often times this will happen when there is a compile time error in Typescript and the following options are checked:

  1. Compile on save: This will cause the build to be marked as succeeded even when there are compile error in Typescript.
  2. Do not emit outputs if an error are reported: This along with the previous option will make it seem that the build succeeds but the js file is not updated.

enter image description here

Lukkha Coder
  • 4,421
  • 29
  • 25
0

var del = require(gulp-delete);

Just run a gulp del(PathToDelete) before you compile!

Elisabeth
  • 20,496
  • 52
  • 200
  • 321