Open lintellme99 opened 1 month ago
An interesting fact is that if you add a few more files that swc
will have to process (I just cloned all files 6 times with different names), then the bug will disappear
As soon as I had 38 files Successfully compiled: 38 files with swc (37.96ms)
instead of the 6 with which the bug is playing, it stopped reproducing:
TSC Initializing type checker...[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [NestFactory] Starting Nest application...
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] KyselyModule dependencies initialized +6ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] LoggerModule dependencies initialized +1ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [InstanceLoader] KyselyCoreModule dependencies initialized +0ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [RoutesResolver] AppController {/}: +3ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 24965 - 08/05/2024, 5:37:05 PM LOG [NestApplication] Nest application successfully started +1ms
✔ TSC Initializing type checker...
> TSC Found 0 issues.
@kdy1, do you know what the problem might be? I would love to help with this investigation, because I don't understand what's wrong here.
@kdy1 I have "fixed" that bug in this branch: https://github.com/lintellme99/nestjs-swc-bug/tree/without_bug
Now it works fine, but, I want it also work correctly on a small projects, that has a less than 30 files that swc
should handle
Describe the bug
Application initializes twice when using SWC with NestJS
nest start --watch
(npm run start:dev
in the repo's scripts), even though withnest start
(npm run start
in the repos' scripts) it works fine, without unnecessary re-initializeI've upload the whole code to the repository (with
README.md
) where you can reproduce this bug: https://github.com/lintellme99/nestjs-swc-bugInput code
No response
Config
Playground link (or link to the minimal reproduction)
https://github.com/lintellme99/nestjs-swc-bug
SWC Info output
Operating System: Platform: darwin Arch: arm64 Machine Type: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030 CPU: (12 cores) Models: Apple M3 Pro
Expected behavior
NestJS
nest start --watch
command executes only one initializition ofmain.ts
file andbootstrap
functionActual behavior
NestJS
nest start --watch
command executes two initializitions ofmain.ts
file andbootstrap
functionVersion
"@swc/cli": "0.4.0", "@swc/core": "1.7.6"
Additional context
No response