Open mstier-nflx opened 1 year ago
Could you describe more what you mean by "Pull package into project (call it bar) " - are you doing an npm publish
to a registry and then fetching it back from the registry again? Using git submodule
or npm_package
or some other way?
We have workspaces configured. Bar and foo live under the same root project. https://docs.npmjs.com/cli/v7/using-npm/workspaces
We have a configuration for foo setup in our BUILD.bzl at the root. npm_link_package( name = "node_modules/@rule-ts-transitive-dep-issues-example/foo-package", src = "//foo:dist", )
Our foo project has a ts_project setup like ts_project( name = "src_ts", srcs = SRCS, composite = True, declaration = True, declaration_dir = "types", resolve_json_module = True, tsconfig = ":ts_config", supports_workers = False, visibility = ["//visibility:public"], deps = [ "//:node_modules/@rule-ts-transitive-dep-issues-example/foo-package", ] , ) SRCS = glob(include = [ "index.ts", "package.json", ])
I created a test repo based on what I was using, (not the cleanest) but the instructions are in the README.md Test Repo
What happened?
I am have been having build issues related to incorrect types being produced by my Bazel builds. I have a package where it has a "types" field defined in its package json as "types" : "dist/types/lib/index.d.ts". I am seeing the package build correctly with the index.d.ts files placed correctly.
However when I pull the package into another project and build using Bazel, I produce a new index.d.ts file with the transitive type set to "any". When I build using a different tool (razzle), it is correctly generating the new index.d.ts file with the transitive type set correctly.
I noticed when I go back to the original package and rebuild it using no "declarationDir" in the tsconfig.json, it produces the "index.d.ts" in the root (as expected). Then when I pull the package into my other project, Bazel starts to produce the new index.d.ts with transitive types correctly. This looks like its related to bazelbuild/rules_nodejs/issues/2044
Version
Development (host) and target OS/architectures: MacOs
Output of
bazel --version
: 6.3Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file: aspect_rules_ts@1.4.5Language(s) and/or frameworks involved: Typescript
How to reproduce
Any other information?
No response