如何将多个源文件传递给 TypeScript 编译器? [英] How can I pass multiple source files to the TypeScript compiler?

查看:30
本文介绍了如何将多个源文件传递给 TypeScript 编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TypeScript 是为大型 JavaScripty 项目设计的,这些项目通常由多个内部生成的文件和外部生成的库组成.TypeScript 编译器 (tsc) 如何期望您向它提供构成项目的完整文件集?

TypeScript is designed for large-scale JavaScripty projects which typically consist of multiple internally produced files along with externally produced libraries. How does the TypeScript compiler (tsc) expect you to provide it with the complete set of files that make up a project?

推荐答案

dir *.ts /b /s > ts-files.txt
tsc @ts-files.txt
del ts-files.txt

这将编译工作目录及其子目录中的所有 *.ts 文件.如果您不想包含子目录,只需从第一行中删除 /s 部分.

This will compile all *.ts files in working directory and its sub directories. If you don't want to include sub directories, just remove the /s part from the first line.

请注意,您还可以向 tsc 行添加其他参数.这是我现在用于我的一个项目的内容:

Note that you can also add other arguments to the tsc line. Here is what I'm using now for one of my projects:

tsc @ts-files.txt --out ..\output\deerchao.web.js --removeComments

这篇关于如何将多个源文件传递给 TypeScript 编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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