简体   繁体   English

lerna monorepo 中的 tsconfig.json 继承出现 TS18003 错误

[英]TS18003 error with tsconfig.json inheritance in lerna monorepo

I have a monorepo using lerna as the repo manager and multiple packages with tsconfig.json files.我有一个使用 lerna 作为回购管理器的 monorepo 和带有tsconfig.json文件的多个包。 I'd like to have a custom base tsconfig.json file and other ones to inherit from the base one.我想要一个自定义的基本tsconfig.json文件和其他从基本文件继承的文件。 Upon running tsc in a project with a tsconfig.json file inheriting from the base one, I receive the following error message:在具有从基础文件继承的tsconfig.json文件的项目中运行tsc时,我收到以下错误消息:

error TS18003: No inputs were found in config file '[...]/packages/core/tsconfig.json'. Specified 'include' paths were '["../tsconfig/src/"]' and 'exclude' paths were '[]'.

The include path should actually be ./src (which would resolve to [...]/packages/core/src ) in the inheriting tsconfig.json and not ../tsconfig/src/ .包含路径实际上应该是./src (它将解析为[...]/packages/core/src )在继承tsconfig.json而不是../tsconfig/src/

I'm aware of the fact that inheritance will overwrite keys instead of merging, which in fact is not the problem here.我知道继承将覆盖键而不是合并这一事实,这实际上不是这里的问题。 I already tried setting the properties rootUrl and baseUrl and realized afterwards the include property is not affected by them.我已经尝试设置属性rootUrlbaseUrl ,之后意识到include属性不受它们的影响。

What am I missing?我错过了什么?

Below are my tsconfig.json files:下面是我的tsconfig.json文件:


packages/tsconfig/tsconfig.json : packages/tsconfig/tsconfig.json

{
    "extends": "@sindresorhus/tsconfig",
    "compilerOptions": {
        "outDir": "dist",
    },
    "include": [
        "src/",
    ]
}

packages/core/tsconfig.json : packages/core/tsconfig.json

{
    "extends": "tsconfig"
    // This is where the include array should appear upon inheriting
    // without the path getting transformed to ../tsconfig/src/
}

I suggest trying to change configuration in packages/core/tsconfig.json like this:我建议尝试像这样更改packages/core/tsconfig.json中的配置:

{
    "extends": "../tsconfig/tsconfig",
}

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

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