TypeScript将所有ts文件编译为WebStorm 7中的单个JavaScript文件 [英] TypeScript compile all ts files as a single JavaScript file in WebStorm 7
问题描述
我的项目中有很多.ts文件。 WebStorm将每个.ts文件构建为js文件。但我不想那样。
I have a lot of .ts files in my project. WebStorm build each .ts file as a js file. But I dont want that.
我有一个app.ts文件,所有其他.ts文件都将在该app.ts文件中构建。我怎么能在WebStorm 7中做到这一点?
I have an app.ts file and all other .ts files will be build in that app.ts file. How can I do that in WebStorm 7?
在CLI模式下有一个解决方案,但我如何在WebStorm中实现它?
There is a solution in CLI mode but how can i implement it in WebStorm?
tsc --out app.js main.ts app.ts a.ts b.ts
或者有更好的方法吗?
ANSWER
在Edit Watcher的Arguments部分添加了这一行
Just added this line at Arguments section in Edit Watcher
--sourcemap $FileName$ --out your-main.js
推荐答案
你可以指定在Typescript文件观察者参数中的--out选项,并且,如果启用仅跟踪根文件选项,则所有ts文件将合并到主js文件(直接或通过引用链全部导入)修改其中任何一个
You can specify --out option in Typescript File watcher arguments, and, if 'track only root files' option is on, all ts files will be merged into a main js file (that imports them all directly or via references chain) on modifying any of them
这篇关于TypeScript将所有ts文件编译为WebStorm 7中的单个JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!