Preview command
Launch an already-built extension output for production-like manual testing.
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
previewis run-only. It prefersdist/<browser>when that output exists, but it can also run from another unpacked extension directory if that directory already contains amanifest.json.
Usage
If no path is provided, process.cwd() is used.
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 directory
--output-pathwhen you explicitly point to an unpacked extension root
What matters is not whether a build happened in the same command. What matters is whether the chosen directory already contains an unpacked extension with a manifest.json.
Core options
Automation metadata
preview writes readiness metadata to:
dist/extension-js/<browser>/ready.json
For --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
Source inspection flags (not supported in preview)
preview accepts these flags in parsing, but exits with an error if you use them. Use dev --source ... instead.
Shared global options
Also supports global flags.
Examples
Previewing a local extension
Previewing in Edge and Chrome
Preview without launching browser
Important 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/HMR.- Source inspection flags are not supported in
preview; usedevfor that workflow. - For scripts/agents, rely on
ready.jsonand avoid parsing terminal output.
Best practices
- Run
buildbeforepreviewwhen testing a fresh production artifact. - Pass
--output-pathwhen 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 config env loading behavior in Environment variables.
