NestJS with SWC has a different behavior than with TSC on monorepos
gabrielbull opened this issue · 1 comments
gabrielbull commented
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
NestJS only compiles the main project when using the SWC compiler instead of compiling dependencies like it does with TSC.
Here is a minimum reproduction of a working repo with TSC: https://github.com/gabrielbull/nestjs-monorepo-tsc
Minimum reproduction code
https://github.com/gabrielbull/nestjs-monorepo-swc
Steps to reproduce
yarn install
yarn workspace project start
Expected behavior
NestJS should compile both project and lib with SWC like it does with TSC
Package version
10.4.0
NestJS version
10.3.10
Node.js version
20.12.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
I have provided my current workaround in the https://github.com/gabrielbull/nestjs-monorepo-swc repository using the command:
yarn workspace project start:workaround
Basically, only running SWC to compile the lib package manually. Here's what I'm basically doing:
swc --config-file .swcrc --out-dir ./dist --strip-leading-paths --extensions .js,.ts ../lib/src
nest start
It works, but it's annoying to have to use nodemon and custom scripts to replace NestJS built in scripts.