【发布时间】:2020-07-10 18:00:37
【问题描述】:
我正在为客户将一个大型(ish)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 包,所以我不太明白这个错误。
我在 repo (https://github.com/serge-web/serge/blob/feature/333-game-admin-channel/tsconfig.json) 的根目录中有一个主 tsconfig 文件,然后每个包都有它自己的 tsconfig 文件,该文件扩展了该文件。 components 包的一个在这里:https://github.com/serge-web/serge/blob/feature/333-game-admin-channel/packages/components/tsconfig.json
我假设我错误地扩展了包中的 tsconfig 文件,或者我错误地使用了references,但我找不到正确的方法。
如果你需要查看结构,这里是一个 repo 的链接:https://github.com/serge-web/serge/tree/feature/333-game-admin-channel
【问题讨论】:
标签: typescript yarnpkg lerna monorepo yarn-workspaces