TypeScript 0.8.2 compile AMD modules to save

NB: I am using TypeScript in Visual Studio 2010, so unfortunately using Web Essentials 2012 as a solution is not an option.

TypeScript 0.8.2 added the compile on save feature , which I enabled in my project by following the instructions on this page.The only additional change I made to the project file is to add

<TypeScriptModuleKind>amd</TypeScriptModuleKind>

      

for each of the groups that tell TypeScript that my files are generated as AMD modules.

This works great when the project is fully built, but when I save one file and the auto compile triggers it does it without switching the module and the generated Javascript no longer works.

Is there a way to force compilation to save the function in order to apply certain parameters to the tsc call?


Update:

A bit more searching and I found this work item where someone else has a different problem. It has been closed since it cannot reproduce, so someone can confirm that it works for them, and if I should accept this quote:

Save compilation options specified in the project file ...

Suppose there is some way to tweak the options to compile while saving separately for the debug and release options defined on the wiki page I linked to above?

+3


source to share


2 answers


This issue has been fixed in subsequent releases; See also the issues related to the ability to specify an output file for Compile-on-Save. if you are using Visual Studio 2012 or Visual Studio 2013, consider upgrading to a later build.



You can try out beta 0.9.5: https://typescript.codeplex.com/wikipage?title=TypeScript%200.9.5%20beta

+1


source


You can define a custom target in the .csproj file, or use the one defined in Microsoft.TypeScript.targets and then link the custom tool to one of your .ts files.

To do this, simply set the "Custom Tool" property to file: * MSBuild: *** NameOfYourMSBuildTarget *



The target will be called every time the files associated with the custom tool are saved.

See my answer to this question for more details on this approach.

0


source







All Articles