tsconfig.json - 仅从文件夹构建 ts 文件 [英] tsconfig.json - Only build ts files from folder
问题描述
我目前正在尝试将我的 ts 文件构建为单个 ts 文件.我遇到的问题是我下面的代码没有按照我的想法去做.我使用 sourceRoot 尝试设置它可以从中获取源的唯一位置,但这不起作用.我也试过把 .在目录前面,但它仍然从任何地方拉:(
I am currently trying to build my ts files into a single ts files. The issue I'm getting is that my code below isn't doing what I thought it would. I used sourceRoot to attempt to set the only place it could get the source from but that didn't work. I have also tried putting a . infront of the directory but it still pulls from everywhere :(
{
"compilerOptions": {
"target": "ES5",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"out": "www/js/app.js",
"sourceMap": true,
"sourceRoot": "www/app"
}
}
所有文件,包括不在 www/app build 中的文件:(
all files including those not inside of www/app build :(
现在我已经改回手动指定文件了:
for now I've moved back to manually specifying the files:
{
"compilerOptions": {
"target": "ES5",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"out": "www/js/app.js",
"sourceMap": true
},
"files": [
"./www/app/app.ts",
"./www/app/menu/menuController.ts",
"./www/app/playlists/playlistsController.ts"
]
}
是否可以将源目录限制为只有 www/app?
is it possible to restrict the source directories to be only www/app?
谢谢
推荐答案
是的,这是可能的.请使用 rootDir
像 'rootDir': 'app'
,如果 www
是你的应用程序的根目录.
Yes,it is possible. Please use rootDir
like 'rootDir': 'app'
, if www
is your root dir of your application.
rootDir
描述来自 typescript 编译器选项:
指定输入文件的根目录.
Specifies the root directory of input files.
这篇关于tsconfig.json - 仅从文件夹构建 ts 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!