NitroStack Logo
/cli
/build

Build Command

Usage

Bash
nitrostack-cli build [options]

Options

OptionDescriptionDefault
--output <path>Output directory for compiled JavaScriptdist

What It Does

When running nitrostack-cli build:

  1. Auto-Detects Widgets:

    • If src/widgets/package.json exists, installs widget dependencies (if node_modules is missing).
    • Scans src/widgets/app/ for widget entrypoints (page.tsx or page.jsx).
    • Bundles each widget into standalone, inline HTML files in src/widgets/out/<widget-name>.html via esbuild with React aliasing.
  2. Compiles TypeScript:

    • Executes TypeScript compiler (npx tsc) using your project's tsconfig.json.
    • Writes compiled JavaScript files to the configured output directory (default: dist/).

Output Structure

Text
dist/
├── index.js               # Server entry point
├── app.module.js          # Root application module
├── modules/               # Feature modules
└── ...

src/widgets/out/           # Standalone widget bundles (if widgets present)
├── calculator-result.html
└── ...

Production Deployment

After running nitrostack-cli build, launch your production server:

Bash
# Using CLI
nitrostack-cli start --port 3000

# Or using Node directly
node dist/index.js

Next Steps