The webview CLI can package your application into a single self-contained executable — no Node.js, Deno, or Bun installation required on the target machine.
# Install globally (or use npx)
npm install -g @webviewjs/webview
# Build with your current runtime (Node.js by default)
webview --build --input src/index.js --name myapp
The executable is written to dist/ by default. On Windows it gets a .exe extension automatically.
Use --runtime (short: -R) to select how the executable is compiled:
| Runtime | Flag | Tool used |
|---|---|---|
| Node.js | --runtime node |
Node.js SEA (default) |
| Deno | --runtime deno |
deno compile |
| Bun | --runtime bun |
bun build --compile |
Node.js does not have a one-shot compile command, so the CLI automates the multi-step Single Executable Application (SEA) workflow for you:
sea-config.json in the output directory.node --experimental-sea-config sea-config.json to produce sea-prep.blob.node binary.postject (downloaded automatically with npx).codesign on macOS, signtool on Windows — optional).webview --build --runtime node --input src/index.js --name myapp --output dist
Pass a JSON file mapping asset names to file paths via --resources:
{
"icon.png": "./assets/icon.png",
"config.json": "./config.json"
}
webview --build --runtime node --resources assets.json --input src/index.js --name myapp
Inside your script, read them with the node:sea API:
const { getAsset } = require('node:sea');
const iconBuffer = getAsset('icon.png');
Requires deno on your PATH. Uses deno compile which bundles everything into a single binary.
webview --build --runtime deno --input src/index.ts --name myapp --output dist
The CLI runs:
deno compile --allow-all --no-check --output dist/myapp src/index.ts
--allow-allgrants all permissions. Restrict them in your own build script if needed.
Requires bun on your PATH. Uses bun build --compile.
webview --build --runtime bun --input src/index.ts --name myapp --output dist
The CLI runs:
bun build --compile src/index.ts --outfile dist/myapp
On Windows, Bun automatically appends .exe if not already present.
-b, --build Build the project into a standalone executable
-R, --runtime Runtime to use for compilation: node (default), deno, bun
-n, --name Executable name (default: webviewjs)
-i, --input Entry file (default: index.js in cwd)
-o, --output Output directory (default: dist/)
-r, --resources Resources mapping JSON file path (node runtime only)
-d, --dry-run Print what would be done without executing
-h, --help Show help
-v, --version Show version
# Node.js SEA — default, no extra tools needed beyond node + npx
webview --build --input src/main.js --name myapp
# Deno — produces a single binary including the Deno runtime
webview --build --runtime deno --input src/main.ts --name myapp
# Bun — fast compilation, includes the Bun runtime
webview --build --runtime bun --input src/main.ts --name myapp
# Custom output directory and project name
webview --build --runtime bun --input src/main.ts --name "MyDesktopApp" --output ./release
# Dry-run to see what would happen
webview --build --runtime node --input src/main.js --name myapp --dry-run
| Platform | Node SEA | Deno compile | Bun compile |
|---|---|---|---|
| Windows | ✅ .exe auto-added |
✅ .exe auto-added |
✅ .exe auto-added |
| macOS | ✅ codesign applied | ✅ ad-hoc signed | ✅ |
| Linux | ✅ | ✅ | ✅ |
codesign -s - (macOS) or signtool (Windows) if available.codesign / signtool for distribution.codesign on macOS after building. On Windows, use signtool.--target directly to deno compile. Use a custom build script rather than the webviewjs CLI for cross-compile targets.--target to bun build. Same recommendation.