nestia icon indicating copy to clipboard operation
nestia copied to clipboard

Support imports from packages in yarn workspace

Open jonasschultheiss opened this issue 2 years ago • 1 comments

We have a yarn workspace monorepo containing our six microservices and four packages. When I run nestia, it cannot resolve the path of the packages.

❯ yarn nestia swagger "src/**/*.controller.ts" --out "swagger.json"
yarn run v1.22.19
$ /Users/jonasschultheiss/coding/company/customer/backend/node_modules/.bin/nestia swagger 'src/**/*.controller.ts' --out swagger.json
⨯ Unable to compile TypeScript:
src/app-versions/app-versions.controller.ts:24:8 - error TS2307: Cannot find module '@customer/backend_packages_schema' or its corresponding type declarations.

24 } from '@customer/backend_packages_schema';
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app-versions/app-versions.controller.ts:25:53 - error TS2307: Cannot find module '@customer/backend_packages_utils' or its corresponding type declarations.

25 import { fetchFromServiceAsGateway, Services } from '@customer/backend_packages_utils';
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm going to test out if it works with paths declared in the tsconfig.json. If it works, I'll close this issue.

jonasschultheiss avatar Sep 30 '22 11:09 jonasschultheiss

If not works, can you provide me a sample repo for testing?

samchon avatar Sep 30 '22 12:09 samchon