Configuration
The wvb.config file that the CLI and the programmatic API read for pack, remote, serve, and builtin options.
A single wvb.config file drives every Webview Bundle workflow. Both the wvb CLI
and the programmatic API (@wvb/cli/api) load it, so one config keeps packing,
serving, remote publishing, and builtin installs consistent. Author it with
defineConfig from @wvb/config to get full type-checking and editor autocompletion.
Each top-level section has its own page:
pack
Source directory, output path, ignore rules, and per-file headers for wvb pack.
remote
The remote endpoint, uploader/deployer, integrity hashing, and signing.
serve
The local file, port, and log output for the wvb serve preview server.
builtin
Install bundles that ship inside your app from a remote or local workspaces.
The config file
Place the config in your project root. The CLI auto-discovers the first matching file in the working directory, in this order:
wvb.config.js
wvb.config.cjs
wvb.config.mjs
wvb.config.ts
wvb.config.cts
wvb.config.mts
webview-bundle.config.js
webview-bundle.config.cjs
webview-bundle.config.mjs
webview-bundle.config.ts
webview-bundle.config.cts
webview-bundle.config.mts
wvb.config.json
wvb.config.jsoncBoth base names wvb.config.* and webview-bundle.config.* are supported with the
.js, .cjs, .mjs, .ts, .cts, and .mts extensions. The .json and .jsonc
forms are only recognized for the wvb.config base name. Pass --config (alias
-C) to any command to point at a specific file instead of relying on discovery.
wvb pack --config ./configs/wvb.prod.tsdefineConfig
Wrap your config with defineConfig from @wvb/config. It is an identity function
at runtime — its only job is to attach types. It accepts an object, a promise that
resolves to a config, or a synchronous or asynchronous function that returns one, so
you can compute values at load time.
import { defineConfig } from '@wvb/config';
export default defineConfig({
root: process.cwd(),
pack: {
srcDir: './dist',
},
serve: {
port: 4312,
},
});import { defineConfig } from '@wvb/config';
export default defineConfig(async () => {
const endpoint = process.env.WVB_ENDPOINT;
return {
remote: {
endpoint,
},
};
});Install the package as a dev dependency: npm install -D @wvb/config.
Top-level fields
The config object has five optional fields. Nothing else is read at the top level.
| Field | Type | Default |
|---|---|---|
root | string | process.cwd() |
pack | PackConfig | — |
remote | RemoteConfig | — |
serve | ServeConfig | — |
builtin | BuiltinConfig | — |
root sets the project root used to resolve relative paths. It may be absolute or
relative to the config file. Each section field is documented on its own page linked
above.