通过tsc命令输入TypeScript:无需连接即可输出到单个文件 [英] TypeScript via tsc command: Output to single file without concatenation

查看:72
本文介绍了通过tsc命令输入TypeScript:无需连接即可输出到单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将单个.ts文件编译到其他目录?

Is there a way of compiling single .ts file to different directory?

从手动编译命令到其他目录的唯一方法是通过-out 命令,但是它也可以串联相关文件,我不希望这样做:

The only way from the manual command of compilation to different directory is via --out command, but it also does concatenation of dependent files, which I don't want:

--out FILE|DIRECTORY        Concatenate and emit output to single file | Redirect output structure to the directory

是否可以在不连接输入文件的情况下重定向输出?

Is there a way of redirecting the output WITHOUT concatenation of input files?

推荐答案

不幸的是,不可能在没有连接的情况下将多个 *.ts 文件编译成一个 *.js .因为在API级别的打字稿编译选项上是不可能的.

Unfortunately it's impossible to compile multiple *.ts files into one *.js without concatenation. Because it's impossible on API level of typescript compile options.

请参见-out 选项:

已弃用.请改用--outFile.

DEPRECATED. Use --outFile instead.

-outFile 选项的文档:

Documentation of --outFile option:

连接并输出到单个文件.串联的顺序由命令行中传递给编译器的文件列表以及三斜杠引用和导入确定.有关更多详细信息,请参见输出文件顺序文档.

Concatenate and emit output to single file. The order of concatenation is determined by the list of files passed to the compiler on the command line along with triple-slash references and imports. See output file order documentation for more details.

所有打字稿编译器选项

这篇关于通过tsc命令输入TypeScript:无需连接即可输出到单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆