Command-line interface tool for initializing, developing, and maintaining NestJS applications
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Build NestJS applications for production with support for multiple build systems, watch mode, and advanced compilation options. The CLI supports TypeScript compiler, Webpack, and SWC for different performance and feature requirements.
Compiles your NestJS application with comprehensive configuration options and multiple builder support.
# Build applications
nest build [apps...] [options]
# Options:
-c, --config [path] # Path to nest-cli configuration file
-p, --path [path] # Path to tsconfig file
-w, --watch # Run in watch mode (live-reload)
-b, --builder [name] # Builder to be used (tsc, webpack, swc)
--watchAssets # Watch non-ts (e.g., .graphql) files mode
--webpack # Use webpack for compilation (deprecated, use --builder)
--type-check # Enable type checking (when SWC is used)
--webpackPath [path] # Path to webpack configuration
--tsc # Use typescript compiler for compilation
--preserveWatchOutput # Use "preserveWatchOutput" option when using tsc watch mode
--all # Build all projects in a monorepoUsage Examples:
# Basic build
nest build
# Build specific app in monorepo
nest build api-gateway
# Build with watch mode
nest build --watch
# Build using specific builder
nest build --builder webpack
nest build --builder swc
nest build --builder tsc
# Build with asset watching
nest build --watch --watchAssets
# Build all projects in monorepo
nest build --all
# Build with custom config file
nest build --config nest-cli.production.json
# Build with custom TypeScript config
nest build --path tsconfig.production.jsonThe default TypeScript compiler provides standard compilation with full type checking.
# Use TypeScript compiler explicitly
nest build --builder tsc
nest build --tsc
# With watch mode and preserved output
nest build --tsc --watch --preserveWatchOutputFeatures:
Advanced bundling and optimization with hot module replacement support for development.
# Use Webpack builder
nest build --builder webpack
# With custom webpack config
nest build --builder webpack --webpackPath webpack.config.js
# Watch mode with Webpack
nest build --builder webpack --watchFeatures:
High-performance Rust-based compiler for faster builds with optional type checking.
# Use SWC builder
nest build --builder swc
# SWC with type checking enabled
nest build --builder swc --type-check
# SWC in watch mode
nest build --builder swc --watchFeatures:
Enable automatic rebuilding when files change during development.
# Basic watch mode
nest build --watch
# Watch mode with asset monitoring
nest build --watch --watchAssets
# Watch mode with preserved output (tsc only)
nest build --watch --preserveWatchOutputMonitor and rebuild when non-TypeScript files change:
# Watch for changes in .graphql, .json, .proto files
nest build --watch --watchAssetsSupported asset types:
# Build individual applications
nest build api-gateway
nest build user-service
nest build notification-service
# Build multiple specific apps
nest build api-gateway user-service# Build entire monorepo
nest build --allProject-level build configuration:
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"builder": "webpack",
"typeCheck": true,
"assets": ["**/*.proto", "**/*.graphql"],
"watchAssets": true
}
}The build command respects TypeScript configuration:
# Use custom tsconfig file
nest build --path tsconfig.production.jsondist/
├── main.js
├── main.js.map
└── [other compiled files]dist/
├── apps/
│ ├── api-gateway/
│ └── user-service/
└── libs/
├── shared/
└── common/The CLI automatically selects the appropriate builder based on:
--builder flagnest-cli.json configuration# Explicit builder flag (highest priority)
nest build --builder swc
# nest-cli.json compilerOptions.builder
# Available dependencies (webpack, swc, tsc)
# Default fallback to tsc# Invalid builder name
nest build --builder invalid
# Error: Invalid builder option: invalid. Available builders: tsc, webpack, swcWhen using SWC or Webpack without required dependencies, the CLI provides clear installation instructions.
# Fastest builds
nest build --builder swc
# Fast builds with type safety
nest build --builder swc --type-check# Advanced optimization and bundling
nest build --builder webpack
# Development with HMR
nest build --builder webpack --watch# Full TypeScript features and compatibility
nest build --builder tsc
# Incremental builds
nest build --builder tsc --watch