[Bug]: ts_project
s fail on Windows (with standalone strategy) without converting all targets to (composite) project references
#664
Labels
bug
Something isn't working
What happened?
I'm trying to use
ts_project
with granular typescript libraries in our monorepo, which works fine on Linux, but fails on Windows due to lack of sandboxing support (I think). It looks like in general ts_project rules are compiling (or attempting to compile) typescript sources outside of the declaredsrcs
for the target, since the depedency source*.ts
files are available on the path and not just the compiled.d.ts
/*.js
files. This means we get a "'rootDir' is expected to contain all source files." error when depending on any otherts_project
, and/or 2) we get a "EPERM: operation not permitted" error when we compile a dependency in a child directory once and then again in the dependency itselfhttps://github.com/bazelbuild/rules_nodejs/wiki/Debugging-problems-with-ts_project/#ts6059-file-is-not-under-rootdir suggests that this indeed likely related to a standalone spawn strategy, where we have unrelated ts files to the target getting included into the compilation implicitly, but it's unclear what the solve would be on Windows, in the absence of a sandbox spawn strategy.
Version
Development (host) and target OS/architectures: Windows 10 x86_64
Output of
bazel --version
: "bazel 7.1.1"Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file: da284adLanguage(s) and/or frameworks involved: rules_ts examples
How to reproduce
Yields:
Turning on
explainFiles
indicates the inclusion into the compilation sincea.ts
is around and is imported byb.ts
:Any other information?
I'm using a user .bazelrc option to move the startup path close to root because of path length limits (but I reproduced with this disabled as well):
I can workaround this by converting all
ts_project
rules that are dependencies into composite typescript projects, and then add references to the tsconfigs for dependent projects (similar to how it's described and performed in https://github.com/aspect-build/rules_ts/blob/main/examples/project_references/README.md), but it's clunky and requires a specialized tsconfig (either tsconfig.json or inline tsconfig in the target definition which is a little more ergonomic, especially if I have multiple ts_project targets per packageIt feels like I have to be doing something wrong, especially since that README suggests it shouldn't be necessary, but maybe this is just a fundamental limitation in standalone/local mode?
The text was updated successfully, but these errors were encountered: