[英]Can I put tsconfig file in one project and use it in another?
I have submodule in my solution projects. 我的解决方案项目中有子模块。 Both of them(1st 2nd projects) have .ts files, so I want to put tsconfig.json in submodule and share it for both of them. 他们两个(第一个第二个项目)都有.ts文件,所以我想把tsconfig.json放在子模块中并为它们共享它。
In file system they are located like this: 在文件系统中,它们的位置如下:
~/solution
--project1
--Scripts
--(ts files)
--submodule
--tsconfig.json(I want to put it here)
~/solution
--project2
--Scripts
--(ts files)
--submodule
project1's name is equal with project2's name
I have tried to add rootDir to compilerOptions 我试图将rootDir添加到compilerOptions
"rootDir": "..\\project1\\Scripts\\**\\*"
I tried to add 我试着补充一下
"include": [
"..\\project1\\Scripts\\**\\*"
]
None of them work for me. 它们都不适合我。
here is my tsconfig.json 这是我的tsconfig.json
{
"compileOnSave": true,
"buildOnSave": true,
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": true,
"sourceMap": false,
"target": "es5",
"module": "none",
"types": [],
"emitBOM": false,
"charset": "utf8"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
If you want to share a tsconfig between two projects, you can extend a tsconfig.json
file. 如果要在两个项目之间共享tsconfig,可以扩展tsconfig.json
文件。 For example you have a shared file shared.json
. 例如,您有一个共享文件shared.json
。 Each project would have it's own tsconfig.json
file and extending the base file shared.json
, like so: 每个项目都有自己的tsconfig.json
文件并扩展基本文件shared.json
,如下所示:
{
"extends": "../shared",
<options here that are different>
}
More info on this page: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html 关于此页的更多信息: https : //www.typescriptlang.org/docs/handbook/tsconfig-json.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.