Skip to content

API > wxt > WxtDevServer

Interface: WxtDevServer ​

Contents ​

Extends ​

Properties ​

currentOutput ​

currentOutput: undefined | BuildOutput

Stores the current build output of the server.

Source ​

packages/wxt/src/types.ts:584


host ​

host: string

Ex: "localhost"

Inherited from ​

ServerInfo.host

Source ​

packages/wxt/src/types.ts:1310


origin ​

origin: string

Ex: "http://localhost:3000"

Inherited from ​

ServerInfo.origin

Source ​

packages/wxt/src/types.ts:1314


port ​

port: number

Ex: 3000

Inherited from ​

ServerInfo.port

Source ​

packages/wxt/src/types.ts:1312


reloadContentScript ​

reloadContentScript: (payload) => void

Tell the extension to restart a content script.

Parameters ​

▪ payload: ReloadContentScriptPayload

Information about the content script to reload.

Source ​

packages/wxt/src/types.ts:620


reloadExtension ​

reloadExtension: () => void

Tell the extension to reload by running browser.runtime.reload.

Source ​

packages/wxt/src/types.ts:601


reloadPage ​

reloadPage: (path) => void

Tell an extension page to reload.

The path is the bundle path, not the input paths, so if the input paths is "src/options/index.html", you would pass "options.html" because that's where it is written to in the dist directory, and where it's available at in the actual extension.

Example ​

ts
server.reloadPage('popup.html');
  server.reloadPage('sandbox.html');

Parameters ​

▪ path: string

Source ​

packages/wxt/src/types.ts:614


restartBrowser ​

restartBrowser: () => void

Grab the latest runner config and restart the browser.

Source ​

packages/wxt/src/types.ts:622


watcher ​

watcher: FSWatcher

Chokidar file watcher instance.

Inherited from ​

Omit.watcher

Source ​

packages/wxt/src/types.ts:1304


ws ​

ws: object

The web socket server used to communicate with the extension.

Type declaration ​

on() ​

Listen for messages over the server's websocket.

Parameters ​

▪ message: string

▪ cb: (payload) => void

send() ​

Send a message via the server's websocket, with an optional payload.

Parameters ​

▪ message: string

▪ payload?: any

Returns ​
Example ​
ts
ws.send("wxt:reload-extension");
  ws.send("wxt:reload-content-script", { ... });

Inherited from ​

Omit.ws

Source ​

packages/wxt/src/types.ts:1291

Methods ​

on() ​

optional on(event, callback): void

Parameters ​

▪ event: string

▪ callback: () => void

Inherited from ​

Omit.on

Source ​

packages/wxt/src/types.ts:1305


restart() ​

restart(): Promise<void>

Close the browser, stop the server, rebuild the entire extension, and start the server again.

Source ​

packages/wxt/src/types.ts:593


start() ​

start(): Promise<void>

Start the server.

Source ​

packages/wxt/src/types.ts:586


stop() ​

stop(): Promise<void>

Stop the server.

Source ​

packages/wxt/src/types.ts:588


transformHtml() ​

transformHtml(url, html, originalUrl?): Promise<string>

Transform the HTML for dev mode.

Parameters ​

▪ url: string

▪ html: string

▪ originalUrl?: string

Overrides ​

Omit.transformHtml

Source ​

packages/wxt/src/types.ts:595


Generated using typedoc-plugin-markdown and TypeDoc