繁体   English   中英

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

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

我有一个使用 lerna 作为回购管理器的 monorepo 和带有tsconfig.json文件的多个包。 我想要一个自定义的基本tsconfig.json文件和其他从基本文件继承的文件。 在具有从基础文件继承的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 '[]'.

包含路径实际上应该是./src (它将解析为[...]/packages/core/src )在继承tsconfig.json而不是../tsconfig/src/

我知道继承将覆盖键而不是合并这一事实,这实际上不是这里的问题。 我已经尝试设置属性rootUrlbaseUrl ,之后意识到include属性不受它们的影响。

我错过了什么?

下面是我的tsconfig.json文件:


packages/tsconfig/tsconfig.json

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

packages/core/tsconfig.json

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

我建议尝试像这样更改packages/core/tsconfig.json中的配置:

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

暂无
暂无

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

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