简体   繁体   中英

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. I'd like to have a custom base tsconfig.json file and other ones to inherit from the base one. Upon running tsc in a project with a tsconfig.json file inheriting from the base one, I receive the following error message:

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/ .

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.

What am I missing?

Below are my tsconfig.json files:


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/
}

I suggest trying to change configuration in packages/core/tsconfig.json like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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