Nestjs:如何构建nestjs 应用程序并生成dist 文件夹?

mar*_*odb 8 node.js nestjs

我正在尝试编写 jenkins shell 脚本来部署 nestjs 应用程序,我尝试使用“npm run start:prod”来生成 dist 文件夹,但它也为我不需要它的应用程序提供服务,

如何只构建应用程序?

Iva*_*vic 8

你可以运行:

npm run build

这只会构建应用程序。当您使用 Nest CLI 生成项目时,可以在生成的 Nest.js 项目中找到此脚本。

脚本本身可能如下所示:

"build": "tsc -p tsconfig.build.json"

的内容tsconfig.build.json可能如下所示:

{
  "extends": "./tsconfig.json",
  "exclude": ["node_modules", "test", "**/*spec.ts"]
}
Run Code Online (Sandbox Code Playgroud)