feat(api-v2): add SWC compiler support for faster builds #26176
+959
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR configures API v2 (NestJS) to use SWC (Speedy Web Compiler) instead of the default TypeScript compiler for faster build times. SWC is a Rust-based compiler that is ~20x faster than tsc and is officially supported by NestJS.
Changes:
@swc/cliand@swc/coreas dev dependencies.swcrcconfiguration withdecoratorMetadata: true(required for NestJS dependency injection)nest-cli.jsonto use"builder": "swc"with"typeCheck": trueto ensure the swagger plugin continues to workThis is Phase 1 of a potential migration away from the current Vite-based bundling setup for platform libraries.
Link to Devin run: https://app.devin.ai/sessions/33c4374e933d4f1c840016c6d1102a24
Requested by: keith@cal.com (@keithwillcode)
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
cd apps/api/v2 && yarn nest buildto verify SWC compilation works/api/v2/docsNote: There are pre-existing type errors in
@calcom/trpcpackage that cause the build to fail withtypeCheck: true. These errors exist on the main branch as well and are unrelated to this PR. CI may need these fixed first, ortypeCheckcould be temporarily set tofalse.Human Review Checklist
.swcrcconfiguration is correct for NestJS (especiallydecoratorMetadata: true)Checklist