Skip to content
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

Adapt relative paths resolution to tsconfig outDir depth #2706

Open
2 of 4 tasks
mgrisole opened this issue Nov 14, 2023 · 1 comment · May be fixed by #2707
Open
2 of 4 tasks

Adapt relative paths resolution to tsconfig outDir depth #2706

mgrisole opened this issue Nov 14, 2023 · 1 comment · May be fixed by #2707

Comments

@mgrisole
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

This issue is almost a duplicate of #2114, I can't figure out why this should be address in Discord since it is a real bug and we are facing exactly the same issue in a pnpm workspace.

I can get it working by performing this manual change on dist:

  • Open apps/nest/dist/src/app.controller.js
  • Change require("../../../packages/math-helpers/dist/index").Me to require("../../../../packages/math-helpers/dist/index").Me

Possible related issues:
#1386
#501

Minimum reproduction code

https://github.com/bindermuehle/monorepo-issue

Steps to reproduce

  1. npm i
  2. npm run start:dev -w nest

Expected behavior

nest/swagger should correctly resolve the paths

Package version

7.1.10

NestJS version

9.0.0

Node.js version

20.9.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@mgrisole
Copy link
Author

mgrisole commented Nov 14, 2023

Removing one of these two statements fixes the issue, but I fail to understand the whole context at the moment:

if (isAbsolute(importPath)) {
throw {};
}

typeReference = typeReference.replace(importPath, relativePath);

mgrisole added a commit to mgrisole/swagger that referenced this issue Nov 14, 2023
@mgrisole mgrisole linked a pull request Nov 14, 2023 that will close this issue
12 tasks
mgrisole added a commit to mgrisole/swagger that referenced this issue Nov 14, 2023
mgrisole added a commit to mgrisole/swagger that referenced this issue Nov 14, 2023
@mgrisole mgrisole changed the title Wrong path resolution in monorepo Adapt relative paths resolution to tsconfig outDir depth Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant