Dev command

Use dev for day-to-day browser extension development with watch mode, browser launch, and context-aware update behavior.

dev runs the development pipeline, watches project files, and applies update strategies based on what changed (HMR, hard reload, or restart-required diagnostics).

When to use dev

  • Building features and validating changes in real time.
  • Debugging extension behavior in one or more browser targets.
  • Running source-inspection workflows with --source.

Use build for production artifacts, start for production build + launch, and preview to run existing build output only.

If your extension lives inside a monorepo/submodule, review how extension.config.* loads env files (including workspace-root fallback): Environment variables.

What dev gives you

CapabilityOutcome for developers
Watch mode iterationTight edit -> rebuild -> validate loop while coding
Browser-target controlExplicit cross-browser validation per command
Profile-aware runsReliable fresh or persisted profiles by workflow need
Source inspection modeStructured output and diagnostics with source flags

Usage

npm
pnpm
yarn
extension dev [path-or-url] [options]

If no path is provided, Extension.js uses process.cwd().

Core options

FlagAliasWhat it doesDefault
[path or url]-Extension path or remote URL.process.cwd()
--browser <browser>-bBrowser/engine target (chromium, chrome, edge, firefox, engine aliases, or comma-separated values).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-binaryCustom Gecko-family binary path.system default
--polyfill [boolean]-Enable compatibility polyfill behavior.false
--starting-url <url>-Starting URL in launched browser.unset
--port <port>-Dev server port.8080
--no-open-Do not automatically open browser.browser opens by default
--no-browser-Do not launch browser.browser launch enabled
--wait [boolean]-Wait for dist/extension-js/<browser>/ready.json and exit.disabled
--wait-timeout <ms>-Timeout for --wait mode.60000
--wait-format <pretty|json>-Output format for wait results (json is machine-readable).pretty
--extensions <list>-Comma-separated companion extensions or store URLs.unset
--install [boolean]-Install project dependencies when missing.command behavior default
--author--author-modeEnable maintainer diagnostics.disabled

When dev runs, Extension.js emits machine-readable metadata under:

  • dist/extension-js/<browser>/ready.json
  • dist/extension-js/<browser>/events.ndjson

For automation (Playwright, CI, AI agents), prefer these files over terminal log parsing.

ready.json should be treated as the readiness contract:

  • status: "starting" while booting
  • status: "ready" when runtime is ready
  • status: "error" for startup/compile failures
  • runId uniquely identifies a runtime session
  • startedAt marks the runtime session start timestamp

--no-browser and readiness synchronization

--no-browser only disables browser launch. It does not block external runners until compile is usable.

For Playwright/CI/AI workflows:

  1. run extension dev --no-browser as a long-lived process
  2. run extension dev --wait --browser=<browser> as the readiness gate
  3. launch external browser automation only after status: "ready"

--wait is designed for a second process (or CI step) and exits non-zero on error/timeout. When --wait sees a stale ready.json from a dead process (pid no longer alive), it keeps waiting for a live producer. If both --wait and --no-browser are passed to the same command invocation, --wait takes precedence and the command runs in wait-only mode.

Source inspection workflow

Use source options only with dev:

  • --source <url> to run from a remote extension source
  • --watch-source / --no-watch-source to control remote polling behavior

start and preview do not support source-inspection flags.

Source flags

FlagWhat it doesDefault behavior
--source [url]Enable source inspection flow.disabled
--watch-source [boolean]Re-print source output on watched updates.true when --source is enabled
--source-format <pretty|json|ndjson>Output format for source inspection.falls back to log format or json
--source-summary [boolean]Emit compact summary output.disabled
--source-meta [boolean]Include page metadata.enabled when source is on
--source-probe <selectors>Comma-separated CSS selectors to probe.unset
--source-tree <off|root-only>Include compact extension tree details.unset
--source-console [boolean]Include console summary.disabled
--source-dom [boolean]Include DOM snapshots/diffs.enabled when watch-source is on
--source-max-bytes <bytes>Cap output payload size.unset
--source-redact <off|safe|strict>Redaction strategy for source output.format-dependent
--source-include-shadow <off|open-only|all>Control Shadow DOM inclusion.open-only when source is on
--source-diff [boolean]Include diff metadata on watch updates.enabled when watch-source is on

Logging flags

FlagWhat it doesDefault
--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-timestampsDisable timestamps in pretty mode.timestamps enabled
--no-log-colorDisable 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

Shared global options

Also supports global flags.

Examples

Running a local extension

npm
pnpm
yarn
extension dev ./my-extension

Running a remote extension

npm
pnpm
yarn
extension dev --source https://example.com/my-extension.zip

Running in Firefox

npm
pnpm
yarn
extension dev ./my-extension --browser firefox

Running in multiple browsers in sequence

npm
pnpm
yarn
extension dev ./my-extension --browser=chrome,firefox

Running in brave as a custom binary

npm
pnpm
yarn
extension dev ./my-extension --chromium-binary /path/to/brave

Best practices

  • Browser compatibility: Test your extension in different browsers to ensure compatibility with the target audience.
  • Polyfilling: If Firefox or a Gecko-based browser is also a target, use the --polyfill flag to enable compatibility for the browser.* API in Chromium-based browsers.
  • Source inspection workflows: Use dev (not start/preview) when you need source inspection options.
  • Automation reliability: Treat dev as the watch-mode "dev friend" (--no-browser + dev --wait) and start as the production "test friend" (--no-browser + start --wait) for Playwright/CI flows (--wait-format=json for machine consumers).

Next steps