2

Closed

Compile on Save and Export AMD Modules

description

Thanks cretz, I added <TypeScriptModuleKind>AMD</TypeScriptModuleKind> as you suggested.  This causes visual studio to output the correct AMD modules when I build the project, but still outputs non-amd javascript when it compiles on save.   Looks like it may be a bug in the compile on save feature.

file attachments

Closed Jun 13, 2013 at 6:19 PM by RyanCavanaugh
Fixed in develop branch

comments

jonturner wrote Feb 4, 2013 at 8:01 PM

paulb wrote Feb 4, 2013 at 8:29 PM

I cannot reproduce this issue.

The Compile on Save options specified in the project file only work when inside the context of a project. If you open the .ts file outside that project, it will use the default options.

** Closed by paulb 02/04/2013 1:29PM

MartinHarris wrote Feb 15, 2013 at 8:26 PM

I am seeing the same issue. I've attached a very simple project which exhibits the problem for me under VS2012.

I've changed the project file from the defaults to:
<PropertyGroup>
    <TypeScriptTarget>ES3</TypeScriptTarget>
    <TypeScriptIncludeComments>true</TypeScriptIncludeComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptModuleKind>amd</TypeScriptModuleKind>
</PropertyGroup>
If you load the project and build the solution then the generated file1.js will correctly be output as a require.js compatible module:
define(["require", "exports"], function(require, exports) {
    var Point = (function () {
        ...
If you edit file1.ts to (for example) change the name of the 'p' variable and save it then the js file will be regenerated, but it will no longer be an amd module:
var Point = (function () {
Changing other project settings such as source map generation and including comments work as expected across both full solution builds and single file saves.

novaleaf wrote Apr 26, 2013 at 4:24 AM

i am still seeing this issue with 0.8.3.1, please reopen

paulb wrote Apr 26, 2013 at 6:41 PM

Taking another look.

paulb wrote Apr 26, 2013 at 7:06 PM

Marked as active.

TobiasHei wrote May 6, 2013 at 2:46 PM

I can confirm this error, see also the Stackoverflow Entry http://stackoverflow.com/questions/14899801/typescript-0-8-2-compile-amd-modules-on-save which led me here