-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts_project doesn't include package.json in transitive typings #2044
Comments
ts_project does forward all the typings to downstream projects |
Error now is: ERROR: /Users/alex.eagle/Projects/rules_nodejs/packages/typescript/test/ts_project/b/BUILD.bazel:6:1: Compiling TypeScript project //packages/typescript/test/ts_project/b:tsconfig [tsc -p packages/typescript/test/ts_project/b/tsconfig.json] failed (Exit 2) tsc.sh failed: error executing command bazel-out/host/bin/external/npm/typescript/bin/tsc.sh --emitBOM --project packages/typescript/test/ts_project/b/tsconfig.json --outDir ... (remaining 7 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox bazel-out/darwin-fastbuild/bin/packages/typescript/test/ts_project/a/a.d.ts(2,41): error TS2307: Cannot find module '@babel/parser'.
It may be needed in transitive compilations to resolve the "typings" key Fixes bazel-contrib#2044
Error now is: ERROR: /Users/alex.eagle/Projects/rules_nodejs/packages/typescript/test/ts_project/b/BUILD.bazel:6:1: Compiling TypeScript project //packages/typescript/test/ts_project/b:tsconfig [tsc -p packages/typescript/test/ts_project/b/tsconfig.json] failed (Exit 2) tsc.sh failed: error executing command bazel-out/host/bin/external/npm/typescript/bin/tsc.sh --emitBOM --project packages/typescript/test/ts_project/b/tsconfig.json --outDir ... (remaining 7 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox bazel-out/darwin-fastbuild/bin/packages/typescript/test/ts_project/a/a.d.ts(2,41): error TS2307: Cannot find module '@babel/parser'.
Thanks for the clear issue report! last bugfix squeezing into the 2.0 release 😁 |
yup, just tried 2.0 and it works for me now - thanks! |
🚀 feature request
ts_project rules should be able to depend on each other, without including their transitive npm deps
Relevant Rules
ts_project
Description
Not sure if I am using ts_project incorrectly, I tried searching and found a somewhat related issue about ts_project rules referencing other ts_project rules #1896 so perhaps I should be using an intermediate rule? I've recently tried switching some ts_library rules over to ts_project because of the greater flexibility of the rule
Something I experienced was that if inside inner_dep, I have a class which extends something from sequelize-typescript, when building
test
, ts_project wouldn't be able to find methods on classes that extend sequelize-typescript. I noticed this only happens on some deps and found that this is because inside their package.json, there is an entryWhen using ts_library, the package.json would be in the input files when building test, but when using ts_project, only the typing files are available so tsc cannot find the file. If I change the
test
rule to use ts_library, it seems to build ok even when keepinginner_dep
as ts_project. I did a bit of messing around and found that adding thenode_modules_aspect
that ts_library had in it's deps seemed to make ts_project behave ok but don't really have any idea if that's even the right way to approach this.Describe the solution you'd like
Ideally I would just like ts_project to behave like ts_library in this case and be able to depend on each other without having to add
@npm//sequelize-typescript
to the deps oftest
Describe alternatives you've considered
I know ts_library works and I hacked in node_modules_aspect but would like to see if there is a better way
The text was updated successfully, but these errors were encountered: