[英]Can I put tsconfig file in one project and use it in another?
我的解决方案项目中有子模块。 他们两个(第一个第二个项目)都有.ts文件,所以我想把tsconfig.json放在子模块中并为它们共享它。
在文件系统中,它们的位置如下:
~/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
我试图将rootDir添加到compilerOptions
"rootDir": "..\\project1\\Scripts\\**\\*"
我试着补充一下
"include": [
"..\\project1\\Scripts\\**\\*"
]
它们都不适合我。
这是我的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"
]
}
如果要在两个项目之间共享tsconfig,可以扩展tsconfig.json
文件。 例如,您有一个共享文件shared.json
。 每个项目都有自己的tsconfig.json
文件并扩展基本文件shared.json
,如下所示:
{
"extends": "../shared",
<options here that are different>
}
关于此页的更多信息: https : //www.typescriptlang.org/docs/handbook/tsconfig-json.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.