Build Command
Usage
Bash
nitrostack-cli build [options]
Options
| Option | Description | Default |
|---|---|---|
--output <path> | Output directory for compiled JavaScript | dist |
What It Does
When running nitrostack-cli build:
-
Auto-Detects Widgets:
- If
src/widgets/package.jsonexists, installs widget dependencies (ifnode_modulesis missing). - Scans
src/widgets/app/for widget entrypoints (page.tsxorpage.jsx). - Bundles each widget into standalone, inline HTML files in
src/widgets/out/<widget-name>.htmlvia esbuild with React aliasing.
- If
-
Compiles TypeScript:
- Executes TypeScript compiler (
npx tsc) using your project'stsconfig.json. - Writes compiled JavaScript files to the configured output directory (default:
dist/).
- Executes TypeScript compiler (
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