Skip to content

Project References docs/example are missing rootDirs (?) #37257

Open
@alexeagle

Description

I'm working on a prototype to rebuild the Bazel TypeScript support on top of Project References, basically following the paragraph

https://www.typescriptlang.org/docs/handbook/project-references.html

Some teams have set up msbuild-based workflows wherein tsconfig files have the same implicit graph ordering as the managed projects they are paired with. If your solution is like this, you can continue to use msbuild with tsc -p along with project references; these are fully interoperable.

where msbuild is replaced by Bazel. Seems very promising so far, however there's a snag.


Looking at Ryan's demo
https://github.com/RyanCavanaugh/project-references-demo
we see that each project uses an outDir setting to avoid sprinkling build outputs in the sources (yay)
https://github.com/RyanCavanaugh/project-references-demo/blob/master/core/tsconfig.json#L4

However in dependent projects there is no matching rootDirs option
https://github.com/RyanCavanaugh/project-references-demo/blob/master/animals/tsconfig.json

According to the README, the empty-sleeves branch deletes the code from the dependent project, so I would expect TS resolves from the .d.ts in the outDir. So I'm not understanding how the compiler could find /lib/core/utilities.d.ts to resolve imports like import { makeRandomName } from '../core/utilities'; that appear in /animals/dog.ts.

Indeed checking out the empty-sleeves branch, it doesn't seem to compile, seems like it's just out-of-date prototype code

tsproject.json:11:5 - error TS5023: Unknown compiler option 'referenceTarget'.

11     "referenceTarget": true

Another way to observe my problem: In my minimal Proof-of-Concept I am forced to specify a rootDirs setting.
https://github.com/alexeagle/ts_composite/blob/master/tsconfig-base.json#L7-L8
and in this case since Bazel creates output directory with the platform name in it, I can't really check in this file and keep the project portable between mac/linux/windows.


So the question is, does TS have some way of resolving the outDir from project references that I'm missing? Or is the rootDirs setting required to make this work?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions