You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But this is using project references where we'll jump back to the correct source.
Is it?
I think this was a point of misunderstanding in the meeting - you've said (a few times) that you won't necessarily have project references set up - how do you anticipate the editor scenarios working?
There's nothing about Bazel that constrains users choices in this regard. In theory you configure it to run whatever tsc command-lines you want.
Even our ts_project "rule" gives users quite a bit of latitude about how to invoke tsc - it is mostly concerned with predicting what outputs will be created given the variety of compilerOptions that affect it, for example --declaration means to expect .d.ts file for each .ts input. But the semantics of defining different "compilation units" is loose.
One option for editors is to open the monorepo root, and the TS language service resolves first-party imports directly to the .ts source file, either by a pathMapping of the package name (import '@myorg/foo') or the relative paths naturally resolving to source locations.
If you instead open a subdirectory in the editor, then yeah you can do a build first to populate the output tree, and afterwards the language service can resolve imports into that tree. I think pretty much every build system does a bad job of supporting this case where relative imports are to a location in the repository but not open in the editor?
Activity
DanielRosenwasser commentedon Feb 25, 2022
CC Alex Eagle (@alexeagle)
DanielRosenwasser commentedon Feb 28, 2022
Just to clarify
I think this was a point of misunderstanding in the meeting - you've said (a few times) that you won't necessarily have project references set up - how do you anticipate the editor scenarios working?
alexeagle commentedon Mar 1, 2022
There's nothing about Bazel that constrains users choices in this regard. In theory you configure it to run whatever
tsccommand-lines you want.Even our
ts_project"rule" gives users quite a bit of latitude about how to invoketsc- it is mostly concerned with predicting what outputs will be created given the variety ofcompilerOptionsthat affect it, for example--declarationmeans to expect.d.tsfile for each.tsinput. But the semantics of defining different "compilation units" is loose.One option for editors is to open the monorepo root, and the TS language service resolves first-party imports directly to the
.tssource file, either by a pathMapping of the package name (import '@myorg/foo') or the relative paths naturally resolving to source locations.If you instead open a subdirectory in the editor, then yeah you can do a build first to populate the output tree, and afterwards the language service can resolve imports into that tree. I think pretty much every build system does a bad job of supporting this case where relative imports are to a location in the repository but not open in the editor?