Path aliases / relative imports in a monorepo breaks nest start
#13558
Labels
needs triage
This issue has not been looked into
nest start
#13558
Is there an existing issue for this?
Current behavior
When adding an external import to a Nest.js app inside a monorepo, an error occurs when running
nest start:dev
.I have setup a repo using pnpm workspaces so that I can share code between different projects. To achieve clean imports I have used path aliases for the shared project, but the same happens when the import uses a relative path.
https://github.com/ChazUK/nest-monorepo-import-error/blob/main/nest-project/src/app.controller.ts#L4
Normally running the start or build command creates a dist structure like below:
But when adding this import it returns a different structure:
Which then produces this error
tsconfig.json
Minimum reproduction code
https://github.com/ChazUK/nest-monorepo-import-error
Steps to reproduce
pnpm i
2
pnpm run --filter nest-project start:dev
Expected behavior
Relative imports and path alisases should not break the Nest.js start command
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
10.0.0
Packages versions
Node.js version
20.11.1
In which operating systems have you tested?
Other
Install pnpm https://pnpm.io/installation
The text was updated successfully, but these errors were encountered: