Skip to main content
The WebviewJS CLI’s --build command packages your application into a single self-contained executable. The target machine does not need Node.js, Deno, or Bun installed — the binary includes your code and the chosen runtime. This makes it straightforward to distribute desktop applications to end users without asking them to install a JavaScript runtime first.
The CLI is available as both the webview command and the webviewjs command. Both are identical — use whichever name is more convenient.

Install the CLI

Install the package globally to add the webview and webviewjs commands to your PATH, or use npx for one-off builds without a global install.

Quick start

Point the CLI at your entry file, give the output binary a name, and let it build.
The executable is written to dist/ by default. On Windows a .exe extension is added automatically.

Choosing a runtime

Use --runtime (short: -R) to select the compilation tool. When --runtime is omitted, the CLI infers the runtime from its own execution environment: bun if run under Bun, deno if run under Deno, and node otherwise. For most users running via npm or npx, the default is node.
Node.js compiles via the Single Executable Application (SEA) workflow. The CLI automates every step: generating the blob config, injecting it with postject, and re-signing the binary on macOS and Windows.
No additional tools beyond node and npx are required. postject is downloaded automatically via npx during the build.

All CLI options

Run --dry-run before a real build to preview every command the CLI would execute. This is useful for verifying that paths, names, and runtime flags are correct before committing to a full compilation.

Bundling assets (Node.js only)

Node.js SEA supports embedding static assets in the binary via the --resources flag. Create a JSON file that maps asset names to file paths on disk. assets.json
Pass the file to the CLI:
Inside your script, read the embedded assets with the node:sea API:
Asset bundling is only available with the Node.js runtime. Deno and Bun include source files directly in their compilation step.

Platform notes

Cross-compilation:
  • Deno and Bun support a --target flag that you can pass via a custom build script for cross-compilation to a different OS or architecture. The WebviewJS CLI does not forward --target for you.
  • Node SEA does not support cross-compilation. Build on the target operating system.

  • Installation — system requirements and first-time setup
  • Quick Start — build and run your first WebviewJS window