简体   繁体   English

tsconfig 包含相对路径

[英]Tsconfig include relative path

I have tsconfig like this:我有这样的 tsconfig:

{
  "compilerOptions": {
    "baseUrl": ".'
  }
  "include": ["**/*.ts", "../additionalDirectory/**/*.ts"]
}

I would like to include additional directory ts files to be transpiled in my main project too.我也想在我的主项目中包含要转译的其他目录 ts 文件。 But unfortunately, include don't work well with relative paths ('../').但不幸的是,include 不适用于相对路径('../')。 And it is not seeing them.它没有看到它们。 I have a monorepo and just want to share some files across my apps.我有一个 monorepo,只想在我的应用程序中共享一些文件。

How should I handle it?我该如何处理?

Thanks in advance :)提前致谢 :)

Please give a try using the files property.请尝试使用 files 属性。

{
"compilerOptions": {
    "module": "commonjs",
    "noImplicitAny": true,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true
},
"files": [
    "core.ts",

],
 "include": ["**/*.ts", "../additionalDirectory/**/*.ts"]

} }

The "files" property takes a list of relative or absolute file paths. “files”属性采用相对或绝对文件路径的列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM