2

I have a package A that exports some types and functions and a package B that use package A as a dependency and export also other types and functions.

I import package A and package B in a package C as dependencies. When I use a type from package A, I use the new nestjs swagger plugin for api documentation, but the types of package A are imported from ./packageB/node_modules/packageA and not directly from package A.

Does anyone know why ?

PS: I am using lerna and packages A, B and C are in the same repository. It looks like the preserveSymlinks option in tsconfig.json has some effect but when I turn it off, the import package is the relative path ('../../../../../packageA' and not 'packageA')

bpAphilia
  • 21
  • 3
  • is it working though? – Chau Tran Feb 17 '20 at 16:00
  • No it is not because when I push it on GCP, the node modules are not downloaded the same way, so package B doesn't have package A in his node_modules folder since it is in the root node_modules folder. @ChauTran – bpAphilia Feb 18 '20 at 12:45
  • I would suggest to raise an issue in nestjs/swagger. Workaround for now is for those models from those packages, just manually decorate them. The way nestjs/swagger/plugin works is pretty specific when it comes to complex models. – Chau Tran Feb 18 '20 at 13:59
  • Thank you Chau. I thought about this but I have a lot of models. Actually I don't think it is a nestjs error but more a lerna error (in jetbrains, when I use auto-import it use the same wrong import) – bpAphilia Feb 18 '20 at 17:04

0 Answers0