Skip to content

API / wxt / WxtDevServer

Interface: WxtDevServer

Source: packages/wxt/src/types.ts:581

Contents

Extends

Properties

currentOutput

currentOutput: BuildOutput | undefined

Source: packages/wxt/src/types.ts:584

Stores the current build output of the server.


host

host: string

Source: packages/wxt/src/types.ts:1325

Ex: "localhost"

Inherited from

ServerInfo.host


on?

optional on?: (event, callback) => void

Source: packages/wxt/src/types.ts:1320

Parameters

event

string

callback

() => void

Returns

void

Inherited from

WxtBuilderServer.on


origin

origin: string

Source: packages/wxt/src/types.ts:1329

Ex: "http://localhost:3000"

Inherited from

ServerInfo.origin


port

port: number

Source: packages/wxt/src/types.ts:1327

Ex: 3000

Inherited from

ServerInfo.port


reloadContentScript

reloadContentScript: (payload) => void

Source: packages/wxt/src/types.ts:620

Tell the extension to restart a content script.

Parameters

payload

ReloadContentScriptPayload

Information about the content script to reload.

Returns

void


reloadExtension

reloadExtension: () => void

Source: packages/wxt/src/types.ts:601

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

Returns

void


reloadPage

reloadPage: (path) => void

Source: packages/wxt/src/types.ts:614

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.

Parameters

path

string

Returns

void

Example

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

restartBrowser

restartBrowser: () => void

Source: packages/wxt/src/types.ts:622

Grab the latest runner config and restart the browser.

Returns

void


watcher

watcher: FSWatcher

Source: packages/wxt/src/types.ts:1319

Chokidar file watcher instance.

Inherited from

WxtBuilderServer.watcher


ws

ws: object

Source: packages/wxt/src/types.ts:1306

The web socket server used to communicate with the extension.

on()

on(message, cb): void

Listen for messages over the server's websocket.

Parameters
message

string

cb

(payload) => void

Returns

void

send()

send(message, payload?): void

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

Parameters
message

string

payload?

any

Returns

void

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

Inherited from

WxtBuilderServer.ws

Methods

restart()

restart(): Promise<void>

Source: packages/wxt/src/types.ts:593

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

Returns

Promise<void>


start()

start(): Promise<void>

Source: packages/wxt/src/types.ts:586

Start the server.

Returns

Promise<void>


stop()

stop(): Promise<void>

Source: packages/wxt/src/types.ts:588

Stop the server.

Returns

Promise<void>


transformHtml()

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

Source: packages/wxt/src/types.ts:595

Transform the HTML for dev mode.

Parameters

url

string

html

string

originalUrl?

string

Returns

Promise<string>

Overrides

WxtBuilderServer.transformHtml


Generated using typedoc-plugin-markdown and TypeDoc