monorepo 中的“'rootDir' 预计包含所有源文件”

Ale*_*igh 14 typescript lerna monorepo yarnpkg yarn-workspaces

我正在为客户将一个大型的 monorepo 转换为 TypeScript,但是,我自己对 TS 还很陌生,并且遇到了一个错误,我找不到明显的修复方法。

TS6059: File '[path to repo root]/packages/config/globals.ts' is not under 'rootDir' '[path to repo root]/packages/components/src'. 'rootDir' is expected to contain all source files.

globals.ts文件不应该存在于components包中,它属于config包,所以我不太明白这个错误。

我在存储库的根目录中有一个主 tsconfig 文件(https://github.com/serge-web/serge/blob/feature/333-game-admin-channel/tsconfig.json),然后每个包都有自己的tsconfig 文件扩展了该文件。该components包的位置在这里: https: //github.com/serge-web/serge/blob/feature/333-game-admin-channel/packages/components/tsconfig.json

我假设我错误地扩展了包中的 tsconfig 文件,或者我references错误地使用了它,但我找不到正确的方法来执行此操作。

如果您需要查看结构,这里是存储库的链接:https://github.com/serge-web/serge/tree/feature/333-game-admin-channel

Ale*_*igh 10

最后的解决方法是从tsconfig.json根目录中的文件(我将其保留为.)以外的所有文件中删除对 rootDir 的任何引用。