Build
Bundle a Seed CLI app for Node.js or compile it into a standalone executable.
Seed CLI gives you two build modes:
- Bundle for Node.js with
seed build - Compile a standalone executable with
seed build --compile
The Full and Minimal templates already include both scripts:
{
"scripts": {
"build": "seed build",
"compile": "seed build --compile --outfile my-cli"
}
}If you generated your project with Seed, @seedcli/cli is already installed as a dev dependency. If you removed it, add it back before using seed build.
Bundle for Node.js
Use this when you want a JavaScript build that runs on Node.js:
npm run build
# or
seed buildseed build reads your project entry point, resolves auto-discovered commands, extensions, and plugins into a static build entry, then bundles the result into dist/index.js.
The output is a plain ES module — typically tens of KB, executable directly via node dist/index.js. This is the usual build mode for CLIs you plan to publish on npm.
Externals
In bundle mode, seed build automatically keeps your runtime dependencies external so the published tarball stays small and uses npm's normal install graph:
dependencies,peerDependencies, andoptionalDependenciesfrompackage.json→ kept externaldevDependenciesand workspace packages → inlined into the bundle- Subpaths like
react/jsx-runtimeare matched against the package root (so addingreactas an external also externalizesreact/jsx-runtime)
You can add more externals via the build.external array in seed.config.ts:
import { defineConfig } from "@seedcli/core";
export default defineConfig({
build: {
external: ["some-native-module", "another-package"],
},
});…or on the CLI for one-off builds:
seed build --external some-native-module,another-packageShebang and Executable Bit
seed build automatically:
- prepends
#!/usr/bin/env nodeto the bundle (unless your entry source already declares one — no double-shebang) - runs
chmod +xon the output so it works directly as abinentry
This means you can point package.json#bin straight at dist/index.js:
{
"type": "module",
"bin": {
"my-cli": "./dist/index.js"
},
"files": ["dist"]
}Sourcemaps
Pass --sourcemap (or set build.bundle.sourcemap: true in config) to emit dist/index.js.map alongside the bundle.
Compile a Standalone Executable
Use this when you want to ship a single executable instead of requiring Node.js on the target machine.
npm run compile
# or
seed build --compileBy default, seed build --compile targets the current host platform. You can target specific platforms with --target:
seed build --compile \
--target node24-macos-arm64,node24-linux-x64,node24-win-x64 \
--outdir distCurrent compile targets:
node24-linux-x64node24-linux-arm64node24-macos-x64node24-macos-arm64node24-win-x64node24-win-arm64node24-linuxstatic-x64all
Use --outfile when you want one explicit output path for a single target. For multi-target builds, use --outdir.
Configure Builds in seed.config.ts
You can keep your preferred build defaults in seed.config.ts:
import { defineConfig } from "@seedcli/core";
export default defineConfig({
build: {
// Applies to both bundle and compile modes
external: ["some-native-module"],
bundle: {
outdir: "dist",
sourcemap: true,
},
compile: {
targets: ["node24-macos-arm64", "node24-linux-x64", "node24-win-x64"],
},
},
});CLI flags still override these defaults for one-off builds.
For shipping guidance, see Distribution. For the full
seed build flag reference, see CLI Tools.