NestJS 使用 SWC 加速开发环境编译构建

NestJS Node.js About 645 words

SWC

SWC (Speedy Web Compiler) is an extensible Rust-based platform that can be used for both compilation and bundling. Using SWC with Nest CLI is a great and simple way to significantly speed up your development process.

安装依赖

仅在开发环境中安装。

npm i --save-dev @swc/cli @swc/core

使用

package.json文件中可以直接在start中添加-b swc参数。

nest start -b swc

或者

nest start --builder swc

或者

npm run start -- -b swc

全局配置

也可以在nest-cli.json中配置builderswc

{
  "compilerOptions": {
    "builder": "swc"
  }
}

输出

> nestjs-demo@0.0.1 start
> nest start -b swc

>  SWC  Running...
Successfully compiled: 5 files with swc (98.55ms)

更多配置

https://docs.nestjs.com/recipes/swc

Views: 11 · Posted: 2026-06-09

———         Thanks for Reading         ———

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓
Prev Post
Today In History
Browsing Refresh