preview does not compile your project. It loads an existing unpacked extension root and runs the browser launcher flow.
When to use preview
- Running existing build output without rebuilding.
- Comparing packaged behavior across browser targets quickly.
- Debugging runtime issues tied to production artifacts rather than dev/watch mode.
Preview command capabilities
| Capability | What it gives you |
|---|---|
| Build-output validation | Test real production artifacts without rebuilding |
| Browser-target checks | Run compiled output against selected browser targets |
| Runner control | Launch or skip browser runner based on workflow needs |
| Fast manual QA | Verify packaging-ready behavior quickly before release |
previewis run-only. It prefersdist/<browser>when that output exists. You can also point it at another unpacked extension folder that already contains amanifest.json.
Usage
How preview chooses what to run
preview checks these locations in order:
dist/<browser>for the selected browser target.- The provided project path or current working folder.
manifest.json. It does not matter whether a build ran in the same command.
Arguments and flags
| Flag | Alias | What it does | Default |
|---|---|---|---|
[path] | - | Preview built extension from a project path. | process.cwd() |
--browser <browser> | - | Browser/engine target (chromium, chrome, edge, firefox, etc.). | chromium |
--profile <path|boolean> | - | Browser profile path or boolean profile mode. | fresh profile |
--chromium-binary <path> | - | Custom Chromium-family binary path. | system default |
--gecko-binary <path> | --firefox-binary | Custom Gecko-family binary path. | system default |
--starting-url <url> | - | Starting URL in launched browser. | unset |
--no-browser | - | Skip browser launch. | browser launch enabled |
--port <port> | - | Runner/devtools port when runner is enabled. Use 0 for OS-assigned port. | 8080 |
--host <host> | - | Host to bind the dev server to. Use 0.0.0.0 for Docker/dev containers. | 127.0.0.1 |
--extensions <list> | - | Comma-separated companion extensions or store URLs. | unset |
--author | --author-mode | Enable maintainer diagnostics. | disabled |
Automation metadata
preview writes readiness metadata to:
dist/extension-js/<browser>/ready.json
--no-browser flows, this provides deterministic command state:
startingwhile command initializesreadywhen run-only validation is completeerrorwhen required output is missing or startup failsrunIdandstartedAtfor session correlation in scripts/agents
preview does not provide a --wait gate flag. For preview automation, consume ready.json directly.
Logging flags
| Flag | What it does | Default |
|---|---|---|
--logs <off|error|warn|info|debug|trace|all> | Minimum log level. | off |
--log-context <list|all> | Context filter (background, content, page, sidebar, popup, options, devtools). | all |
--log-format <pretty|json|ndjson> | Logger output format. | pretty |
--no-log-timestamps | Disable timestamps in pretty mode. | timestamps enabled |
--no-log-color | Disable color in pretty mode. | color enabled |
--log-url <pattern> | Filter log events by URL substring/regex. | unset |
--log-tab <id> | Filter log events by tab ID. | unset |
Source inspection flags (not supported in preview)
The CLI detects these flags and exits with an error before parsing. Use dev --source ... instead.
| Flag | Support in preview |
|---|---|
--source [url] | not supported (command exits with guidance) |
--watch-source [boolean] | not supported (command exits with guidance) |
--source-format <pretty|json|ndjson> | not supported (command exits with guidance) |
--source-summary [boolean] | not supported (command exits with guidance) |
--source-meta [boolean] | not supported (command exits with guidance) |
--source-probe <selectors> | not supported (command exits with guidance) |
--source-tree <off|root-only> | not supported (command exits with guidance) |
--source-console [boolean] | not supported (command exits with guidance) |
--source-dom [boolean] | not supported (command exits with guidance) |
--source-max-bytes <bytes> | not supported (command exits with guidance) |
--source-redact <off|safe|strict> | not supported (command exits with guidance) |
--source-include-shadow <off|open-only|all> | not supported (command exits with guidance) |
--source-diff [boolean] | not supported (command exits with guidance) |
Shared global options
Also supports Global flags.Examples
Previewing a local extension
Previewing in Edge and Chrome
Preview without launching the browser
Behavior notes
previewis run-only and never compiles the project.previewprefers existing build output (dist/<browser>) but can fall back to another unpacked extension root.previewdoes not run watch mode or hot module replacement (HMR).previewdoes not support source inspection flags; usedevfor that workflow.- For scripts/agents, rely on
ready.jsonand avoid parsing terminal output.
Best practices
- Run
buildbeforepreviewwhen testing a fresh production artifact. - Pass the project path argument when your unpacked extension lives outside the default project output.
- Use
--browserto verify behavior across targets before packaging.
Next steps
- Build and launch in one step with
start. - Generate production artifacts with
build. - Configure shared defaults in
extension.config.js. - Review configuration env loading behavior in Environment variables.

