引用 TypeScript 文件在输出中包含整个文件

我创建了一个安装了 TypeScript 0.8.1 和 Web Essentials 的新 Windows 8 JavaScript Blank 应用.

I have created a new Windows 8 JavaScript Blank app with TypeScript 0.8.1 and Web Essentials installed.

我已将文件 foo.tsbar.ts 添加到我的项目中.

I have added both a file foo.ts and bar.ts to my project.

foo.ts 只包含一个简单的类:

foo.ts contains only a simple class:

class Foo
{ }

bar.ts 包含对 foo.ts 的引用和类 bar:

bar.ts contains a reference to foo.ts and a class bar:

/// <reference path="foo.ts" />

class Bar
{ }

奇怪的是 bar.js 同时包含 Bar 和 Foo 类:

The strange thing is that bar.js contains both the Bar and Foo class:

var Foo = (function () {
    function Foo() { }
    return Foo;
})();
var Bar = (function () {
    function Bar() { }
    return Bar;
})();

出了什么问题?我正在使用共享 reference.ts 文件处理一个更大的项目.突然间我所有的 ts 文件都编译成每个 javascript 文件了.

What is going wrong? I'm working on a larger project with a shared reference.ts file. Suddenly all my ts files are compiled to each javascript file.

推荐答案

我确实使用 -out 参数来控制编译器的文件放置.我刚刚发布了此位置的修复以进行测试:http://madskristensen.net/custom/webessentials2012.vsix

I do indeed use the -out parameter to control the compiler's file placements. I've just released the fix to this location for testing: http://madskristensen.net/custom/webessentials2012.vsix

请尝试一下并告诉我它是否有效.谢谢!

Please try it out and tell me if it worked. Thanks!

相关文章