4
我有内部打字模块,这个模块分成几个文件。将多个文件内部模块编译成一个文件AMD模块
a.ts
/// <reference path='_all.ts' />
module A {
// some code
}
b.ts
/// <reference path='_all.ts' />
module A {
// some code
}
_all.ts
/// <reference path='a.ts' />
/// <reference path='b.ts' />
是否可以编译这个模块到一个文件,并使其AMD模块?
一般来说,我该如何“导入”内部模块到外部?例如,当我尝试添加新的文件export.ts:
/// <reference path='_all.ts' />
export module B {
//some code that using module A
}
和饲料export.ts到TSC,它编译它export.js AMD模块,但不包括“A”模块代码在所有。
EDITED 实施例:https://gist.github.com/artemkozlov/8550165
soo'tsc a.ts b.ts --out out.js -m amd -d' should work? – basarat
是的,它会生成一个单独的js文件和一个'''out.d.ts''文件,您可以在其他项目中引用它。 –
谢谢你的回答。但它似乎并不像我期待的那样工作。它不会生成单个输出文件。这是我正在做的和我得到的结果https://gist.github.com/artemkozlov/8550165 – aindl