I've just updated Web Essentials 2012 and found that now I need to use the built-in compile functionality of the Typescript
plugin.
So first I added in the extra code to the project. http://typescript.codeplex.com/wikipage?title=Compile-on-Save
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />
However when I compile, I find a few things:
.min.js
files no longer are being compiled..js
file is incorrectly generated.This .js
:
/// <reference path="../_references.d.ts" />
var ko = require('knockout-mapping');
var library = require("./foo/library");
var myModule;
(function (myModule) {
var Foo = (function () {
function Foo(parameters) {
this.parameters = parameters;
from this .ts
:
import ko = require('knockout-mapping');
import library = require('foo/library');
module myModule {
export class Foo {
constructor(public parameters) {
The import
statement is relative (wrong for my setup), and it is now using a require
instead of define
. How can I fix this?
Thanks.
you can use compiler options to pass in amd : CompilerOptions="-module amd"