Skip to content

@extension-use/wxt ​

A WXT module that adds what Extension-use needs to the manifest WXT generates: the permissions for your action groups, host access, and externally_connectable for your website.

bash
npm install -D @extension-use/wxt

Needs wxt 0.20 or newer.

Use it ​

ts
// wxt.config.ts
import { defineConfig } from "wxt";

export default defineConfig({
  modules: ["@extension-use/wxt"],
  extensionUse: {
    groups: ["runtime", "tabs", "page", "dom", "overlay", "picker"],
    controllerOrigins: ["https://app.example.com"],
    remote: true,
  },
});

Options ​

The options are the same as withExtensionUse():

OptionMeaning
groupsGroups the host enables. Must match defineHost({ groups }). Default: all but the opt-in ones.
controllerOriginsWebsites that connect from a normal tab.
matchesPages the content runtime runs on. Default <all_urls>.
remoteRemote control through a relay: adds storage and alarms.
sidePanelAdds sidePanel. Default true.
injectOnDemandAdds scripting so the host can inject the content script. Default true.

Unknown group names fail the build early.

Entrypoints ​

WXT turns these into manifest entries:

EntrypointBecomesCalls
entrypoints/background.tsThe service workerdefineHost()
entrypoints/content.tsA content scriptstartContentRuntime()
entrypoints/sidepanel/side_panelmountFrameBridge()
entrypoints/options/The options pagemountControlPanel()
entrypoints/offscreen/offscreen.htmlmountOffscreen()

Point defineHost({ contentScript }) at "content-scripts/content.js", which is where WXT puts it.

See the WXT guide for a full walkthrough.

The SDK packages are released under the MIT license.