### Initialize Project with NPM and select Yarn Source: https://wxt.dev/guide/installation Use NPM to start the initialization process, but select Yarn when prompted by the installer. ```shell # Use NPM initially, but select Yarn when prompted npx wxt@latest init ``` -------------------------------- ### start() Source: https://wxt.dev/llms-full.txt Starts the WXT development server. This method should be called to initiate the server process. ```APIDOC ## start() ### Description Starts the server. ### Method `start(): Promise` ### Source [packages/wxt/src/types.ts:525](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/types.ts#L525) ``` -------------------------------- ### Server Started Hook Example Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks The `server:started` hook is executed when the development server has successfully started. It provides the WXT instance and the server object. ```typescript wxt.hooks.hook('server:started', (wxt, server) => { // Dev server has started }); ``` -------------------------------- ### WxtBuilderServer.listen() Source: https://wxt.dev/llms-full.txt Start the server. ```APIDOC ## listen() ### Description Start the server. ### Method listen ### Response #### Success Response (Promise) - Returns a Promise that resolves when the server has started. #### Response Example (No example provided in source) ``` -------------------------------- ### Background Entrypoint Example Source: https://wxt.dev/guide/installation Define a background script for your WXT extension. This example logs 'Hello world!' when the background script is initialized. ```ts export default defineBackground(() => { console.log('Hello world!'); }); ``` -------------------------------- ### Start WXT Server Source: https://wxt.dev/llms-full.txt Starts the WXT development server. ```typescript start(): Promise ``` -------------------------------- ### Install WXT (Bun) Source: https://wxt.dev/guide/installation Install WXT as a development dependency using Bun. ```sh bun add -D wxt ``` -------------------------------- ### Create and Start Development Server Source: https://wxt.dev/llms-full.txt Use `createServer` to initialize a WXT development server with optional inline configuration. The server can then be started. ```typescript const server = await wxt.createServer({ // Enter config... }); await server.start(); ``` -------------------------------- ### server:started Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks Called when the dev server is started. ```APIDOC ## server:started ### Description Called when the dev server is started. ### Parameters #### Parameters - **wxt**: [`Wxt`](/api/reference/wxt/interfaces/wxt) - The configured WXT object - **server**: [`WxtDevServer`](/api/reference/wxt/interfaces/wxtdevserver) - Same as `wxt.server`, the object WXT uses to control the dev server. ``` -------------------------------- ### Run Development Server (Bun) Source: https://wxt.dev/guide/installation Start your WXT extension in development mode using Bun. ```sh bun run dev ``` -------------------------------- ### Install WXT (NPM) Source: https://wxt.dev/guide/installation Install WXT as a development dependency using NPM. ```sh npm i -D wxt ``` -------------------------------- ### createServer() Source: https://wxt.dev/llms-full.txt Start a dev server at the provided port. ```APIDOC ## createServer() ### Description Start a dev server at the provided port. ### Method createServer ### Parameters #### Path Parameters - **info** (ServerInfo) - Required - Information needed to create the server. ### Response #### Success Response (Promise) - Returns a Promise that resolves to a WxtBuilderServer instance. #### Response Example (No example provided in source) ``` -------------------------------- ### Install @wxt-dev/i18n Source: https://wxt.dev/i18n Install the @wxt-dev/i18n package using pnpm. ```sh pnpm i @wxt-dev/i18n ``` -------------------------------- ### Install WXT (PNPM) Source: https://wxt.dev/guide/installation Install WXT as a development dependency using PNPM. ```sh pnpm i -D wxt ``` -------------------------------- ### Run Development Server (NPM) Source: https://wxt.dev/guide/installation Start your WXT extension in development mode using NPM. ```sh npm run dev ``` -------------------------------- ### Install WXT (Yarn) Source: https://wxt.dev/guide/installation Install WXT as a development dependency using Yarn. ```sh yarn add --dev wxt ``` -------------------------------- ### Install WXT Package Source: https://wxt.dev/llms-full.txt Install WXT as a development dependency for your project. ```sh pnpm i -D wxt ``` ```sh bun add -D wxt ``` ```sh npm i -D wxt ``` ```sh yarn add --dev wxt ``` -------------------------------- ### zip:start Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks Called before the zip process starts. It receives the WXT object. ```APIDOC ## zip:start ### Description Called before the zip process starts. ### Parameters #### Path Parameters - **wxt** (Wxt) - The configured WXT object ### Source [packages/wxt/src/types.ts:1416](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/types.ts#L1416) ``` -------------------------------- ### Entrypoint name examples Source: https://wxt.dev/llms-full.txt Provides examples of how the `name` property is derived from different input file paths for WXT entrypoints. ```typescript 'popup.html' → 'popup' 'options/index.html' → 'options' 'named.sandbox.html' → 'named' 'named.sandbox/index.html' → 'named' 'sandbox.html' → 'sandbox' 'sandbox/index.html' → 'sandbox' 'overlay.content.ts' → 'overlay' 'overlay.content/index.ts' → 'overlay' ``` -------------------------------- ### Install @wxt-dev/storage Package Source: https://wxt.dev/storage Install the WXT storage package using your preferred package manager. ```sh npm i @wxt-dev/storage pnpm add @wxt-dev/storage yarn add @wxt-dev/storage bun add @wxt-dev/storage ``` -------------------------------- ### Example wxtDir Path Source: https://wxt.dev/llms-full.txt Illustrates the expected format for the absolute path to the `.wxt` directory in a project. ```typescript '/path/to/project/.wxt'; ``` -------------------------------- ### Install and Zip for Firefox (Bun) Source: https://wxt.dev/guide/essentials/publishing Commands to install dependencies and create a Firefox-compatible ZIP archive using Bun. ```sh bun install bun run zip:firefox ``` -------------------------------- ### Run Development Server (Yarn) Source: https://wxt.dev/guide/installation Start your WXT extension in development mode using Yarn. ```sh yarn dev ``` -------------------------------- ### Background Entrypoint Example: Directory Source: https://wxt.dev/llms-full.txt Example of defining a 'background' entrypoint using a directory named 'background' containing an 'index.ts' file within the 'entrypoints/' directory. ```html 📂 entrypoints/ 📂 background/ 📄 index.ts ``` -------------------------------- ### defineWebExtConfig() Source: https://wxt.dev/llms-full.txt Configures how `web-ext` starts the browser during development. Takes a `WebExtConfig` object and returns it. ```APIDOC ## Function: defineWebExtConfig() ### Description Configure how [`web-ext`](https://github.com/mozilla/web-ext) starts the browser during development. ### Parameters #### Path Parameters - **config** (WebExtConfig) - Required - The web-ext configuration object. ### Returns - WebExtConfig - The processed web-ext configuration. ### Source [packages/wxt/src/core/define-web-ext-config.ts:16](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/core/define-web-ext-config.ts#L16) ``` -------------------------------- ### Run Development Server (PNPM) Source: https://wxt.dev/guide/installation Start your WXT extension in development mode using PNPM. ```sh pnpm dev ``` -------------------------------- ### WebExtConfig Source: https://wxt.dev/llms-full.txt Configuration options for starting the browser with web-ext. ```APIDOC ## Interface: WebExtConfig Options for how [web-ext](https://github.com/mozilla/web-ext) starts the browser. ### Properties * **binaries** (Record) - Optional - List of browser names and the binary that should be used to open the browser. * See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-binary, https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox * **chromiumArgs** (string[]) - Optional - Arguments to pass to the Chromium browser. * See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args * **chromiumPort** (number) - Optional - Set a specific port for Chromium debugging. * **chromiumPref** (Record) - Optional - A map of Chromium preferences. * Example: ```ts { download: { default_directory: "/my/custom/dir", }, } ``` * Default: ```ts { devtools: { synced_preferences_sync_disabled: { skipContentScripts: false, }, }, extensions: { ui: { developer_mode: true, }, } } ``` * **chromiumProfile** (string) - Optional - Path to a Chromium profile directory. * See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-profile * **disabled** (boolean) - Optional - Whether or not to open the browser with the extension installed in dev mode. * Default: `false` * **firefoxArgs** (string[]) - Optional - Arguments to pass to the Firefox browser. * See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args * **firefoxPref** (Record) - Optional - Firefox preferences. * See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#pref * **firefoxProfile** (string) - Optional - Path to a Firefox profile directory. * **keepProfileChanges** (boolean) - Optional - Whether to keep changes to the profile after the browser closes. * **openConsole** (boolean) - Optional - Whether to open the browser's developer console. * **openDevtools** (boolean) - Optional - Whether to open the browser's developer tools. * **startUrls** (string[]) - Optional - URLs to open when the browser starts. ``` -------------------------------- ### Install Polyfill Dependencies Source: https://wxt.dev/llms-full.txt If you choose to continue using the webextension-polyfill, install the necessary packages: `webextension-polyfill` and WXT's new polyfill module. ```sh pnpm i webextension-polyfill @wxt-dev/webextension-polyfill ``` -------------------------------- ### Single File Entrypoint Example Source: https://wxt.dev/guide/essentials/entrypoints Defines a single file entrypoint named 'background.ts' within the 'entrypoints/' directory. ```html 📄 background.ts ``` -------------------------------- ### Example Out Base Directory Path Source: https://wxt.dev/llms-full.txt Specifies the absolute path to the `.output` directory. This is where all build artifacts will be placed. ```typescript '/path/to/project/.output'; ``` -------------------------------- ### zip:extension:start Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks Called before zipping the extension files. It receives the WXT object. ```APIDOC ## zip:extension:start ### Description Called before zipping the extension files. ### Parameters #### Path Parameters - **wxt** (Wxt) - The configured WXT object ### Source [packages/wxt/src/types.ts:1389](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/types.ts#L1389) ``` -------------------------------- ### zip:extension:start Source: https://wxt.dev/llms-full.txt Called before zipping the extension files. ```APIDOC ## zip:extension:start ### Description Called before zipping the extension files. ### Method (wxt) => HookResult ### Parameters #### Path Parameters - **wxt** (Wxt) - Description: The configured WXT object ### Source [packages/wxt/src/types.ts:1389](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/types.ts#L1389) ``` -------------------------------- ### Install @wxt-dev/is-background Package Source: https://wxt.dev/llms-full.txt Command to add the `@wxt-dev/is-background` package to your project using pnpm. ```sh pnpm add @wxt-dev/is-background ``` -------------------------------- ### WebExtConfig Properties Source: https://wxt.dev/api/reference/wxt/interfaces/WebExtConfig Configuration options for how web-ext starts the browser. ```APIDOC ## Interface: WebExtConfig Options for how [`web-ext`](https://github.com/mozilla/web-ext) starts the browser. ### Properties #### binaries > **binaries**?: `Record`<`string`, `string`> List of browser names and the binary that should be used to open the browser. See: * https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-binary * https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox #### chromiumArgs > **chromiumArgs**?: `string`[] See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args #### chromiumPort > **chromiumPort**?: `number` By default, chrome opens a random port for debugging. Set this value to use a specific port. #### chromiumPref > **chromiumPref**?: `Record`<`string`, `any`> An map of chrome preferences from https://chromium.googlesource.com/chromium/src/+/main/chrome/common/pref_names.h Example: ```ts { download: { default_directory: "/my/custom/dir", }, } ``` #### chromiumProfile > **chromiumProfile**?: `string` Path to a Chromium profile to use. If not specified, a temporary profile will be created. #### disabled > **disabled**?: `boolean` If true, the browser will not be started. #### firefoxArgs > **firefoxArgs**?: `string`[] See: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args #### firefoxPref > **firefoxPref**?: `Record`<`string`, `any`> An map of Firefox preferences from https://github.com/mdn/webextensions-examples/blob/master/mv2-data-urls/prefs.json #### firefoxProfile > **firefoxProfile**?: `string` Path to a Firefox profile to use. If not specified, a temporary profile will be created. #### keepProfileChanges > **keepProfileChanges**?: `boolean` If true, the temporary profile will not be deleted after the browser is closed. #### openConsole > **openConsole**?: `boolean` If true, the browser console will be opened. #### openDevtools > **openDevtools**?: `boolean` If true, the browser developer tools will be opened. #### startUrls > **startUrls**?: `string`[] List of URLs to open in the browser after it starts. ``` -------------------------------- ### Bootstrap WXT Project Source: https://wxt.dev/llms-full.txt Run the 'init' command to bootstrap a new WXT project. Follow the on-screen instructions to complete the setup. ```sh pnpm dlx wxt@latest init ``` ```sh bunx wxt@latest init ``` ```sh npx wxt@latest init ``` ```sh # Use NPM initially, but select Yarn when prompted npx wxt@latest init ``` -------------------------------- ### Entrypoint Name Examples Source: https://wxt.dev/llms-full.txt Illustrates how entrypoint names are derived from file paths, used for generating output filenames. ```typescript // popup.html → popup // options/index.html → options // named.sandbox.html → named // named.sandbox/index.html → named // sandbox.html → sandbox // sandbox/index.html → sandbox // overlay.content.ts → overlay // overlay.content/index.ts → overlay // The name is used when generating an output file: // /. ``` -------------------------------- ### Server Created Hook Example Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks The `server:created` hook is called when the development server is created and `wxt.server` is assigned. The server has not started yet. ```typescript wxt.hooks.hook('server:created', (wxt, server) => { // Dev server has been created }); ``` -------------------------------- ### server:created Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks Called when the dev server is created (and `wxt.server` is assigned). Server has not been started yet. ```APIDOC ## server:created ### Description Called when the dev server is created (and `wxt.server` is assigned). Server has not been started yet. ### Parameters #### Parameters - **wxt**: [`Wxt`](/api/reference/wxt/interfaces/wxt) - The configured WXT object - **server**: [`WxtDevServer`](/api/reference/wxt/interfaces/wxtdevserver) - Same as `wxt.server`, the object WXT uses to control the dev server. ``` -------------------------------- ### Run WXT in Development Mode Source: https://wxt.dev/llms-full.txt Start your WXT extension in development mode to see changes live. WXT will automatically open a browser window with your extension installed. ```sh pnpm dev ``` ```sh bun run dev ``` ```sh npm run dev ``` ```sh yarn dev ``` -------------------------------- ### zip:start Source: https://wxt.dev/llms-full.txt Called before the zip process starts. ```APIDOC ## zip:start ### Description Called before the zip process starts. ### Method (wxt) => HookResult ### Parameters #### Path Parameters - **wxt** (Wxt) - Description: The configured WXT object ### Source [packages/wxt/src/types.ts:1383](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/types.ts#L1383) ``` -------------------------------- ### Initialize Project with NPM Source: https://wxt.dev/guide/installation Run this command to initialize a new WXT project using NPM. Follow the on-screen instructions for setup. ```shell npx wxt@latest init ``` -------------------------------- ### Initialize Project with Bun Source: https://wxt.dev/guide/installation Run this command to initialize a new WXT project using Bun. Follow the on-screen instructions for setup. ```shell bunx wxt@latest init ``` -------------------------------- ### Generated Manifest Version Example Source: https://wxt.dev/guide/essentials/config/manifest Illustrates the 'version' and 'version_name' fields generated in the manifest.json based on the package.json version. ```json // .output//manifest.json { "version": "1.3.0", "version_name": "1.3.0-alpha2" } ``` -------------------------------- ### Initialize Project with PNPM Source: https://wxt.dev/guide/installation Run this command to initialize a new WXT project using PNPM. Follow the on-screen instructions for setup. ```shell pnpm dlx wxt@latest init ``` -------------------------------- ### webExt Source: https://wxt.dev/api/reference/wxt/interfaces/InlineConfig Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file. ```APIDOC ## webExt ### Description Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file. ### Type [`WebExtConfig`](/api/reference/wxt/interfaces/webextconfig) ``` -------------------------------- ### prepare() Source: https://wxt.dev/llms-full.txt Prepares the WXT environment with the given configuration. This function is asynchronous and returns a Promise that resolves to void. ```APIDOC ## Function: prepare() > **prepare**(`config`): `Promise`<`void`> ## Parameters ▪ **config**: [`InlineConfig`](../interfaces/InlineConfig.md) ## Source [packages/wxt/src/core/prepare.ts:6](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/core/prepare.ts#L6) ``` -------------------------------- ### Create New Project (Bun) Source: https://wxt.dev/guide/installation Use this command to create a new project directory and initialize it with Bun. ```sh cd my-project bun init ``` -------------------------------- ### createServer() Source: https://wxt.dev/llms-full.txt Creates a development server and pre-builds necessary files before loading the extension. Returns a promise that resolves to a WxtDevServer instance. ```APIDOC ## Function: createServer() ### Description Creates a dev server and pre-builds all the files that need to exist before loading the extension. ### Parameters #### Path Parameters - **inlineConfig?** (InlineConfig) - Optional - Configuration object for the inline server. ### Returns - Promise - A promise that resolves to the WxtDevServer instance. ### Example ```ts const server = await wxt.createServer({ // Enter config... }); await server.start(); ``` ``` -------------------------------- ### Display help message Source: https://wxt.dev/api/cli/wxt-init Use the `-h` or `--help` flag to display the usage and options for the `wxt init` command. ```bash wxt init --help ``` -------------------------------- ### Install PostCSS Rem to Responsive Pixel Source: https://wxt.dev/guide/resources/faq Install the postcss-rem-to-responsive-pixel package as a development dependency. ```sh bun i -D postcss-rem-to-responsive-pixel ``` -------------------------------- ### CopiedPublicFile relativeDest Example Source: https://wxt.dev/llms-full.txt Example of the relative path in the output directory to copy the file to. ```typescript 'content-scripts/base-styles.css'; ``` -------------------------------- ### initialize() Source: https://wxt.dev/llms-full.txt Initializes the WXT project with specified options, including directory, package manager, and template. ```APIDOC ## Function: initialize() ### Description Initializes the WXT project with specified options. ### Parameters #### Path Parameters - **options** (object) - Required - Initialization options. - **directory** (string) - Required - The directory for initialization. - **packageManager** (string) - Required - The package manager to use. - **template** (string) - Required - The template to use for initialization. ### Returns - Promise - A promise that resolves when initialization is complete. ### Source [packages/wxt/src/core/initialize.ts:10](https://github.com/wxt-dev/wxt/blob/9a638449d587f48c2821ca32577c5758346c3290/packages/wxt/src/core/initialize.ts#L10) ``` -------------------------------- ### CopiedPublicFile absoluteSrc Example Source: https://wxt.dev/llms-full.txt Example of the absolute path to a file that will be copied to the output directory. ```typescript '/path/to/any/file.css'; ``` -------------------------------- ### Initialize a new WXT project Source: https://wxt.dev/api/cli/wxt-init Use `wxt init` to create a new WXT project in the current directory or a specified directory. You can optionally specify a template and package manager. ```bash wxt init [directory] ``` -------------------------------- ### Install WXT Analytics Package Source: https://wxt.dev/analytics Install the WXT Analytics NPM package using pnpm. ```bash pnpm i @wxt-dev/analytics ``` -------------------------------- ### wxt prepare CLI Usage Source: https://wxt.dev/api/cli/wxt-prepare Shows the basic usage and available options for the `wxt prepare` command. Use this to understand how to invoke the command and its parameters. ```bash wxt prepare [root] ``` -------------------------------- ### Initialize a new WXT project Source: https://wxt.dev/guide/resources/migrate Use this command to generate a new WXT project. It's recommended to start with a vanilla template and merge it into your existing project. ```bash cd path/to/your/project pnpm dlx wxt@latest init example-wxt --template vanilla ``` -------------------------------- ### Installing @wxt-dev/browser Source: https://wxt.dev/guide/essentials/extension-apis Install the `@wxt-dev/browser` package as a direct dependency to enable type augmentation for browser APIs. ```shell pnpm add @wxt-dev/browser ``` -------------------------------- ### Create New Project Directory Source: https://wxt.dev/llms-full.txt Create a new project directory and navigate into it before initializing your project. ```sh cd my-project pnpm init ``` ```sh cd my-project bun init ``` ```sh cd my-project npm init ``` ```sh cd my-project yarn init ``` -------------------------------- ### Install and Zip for Firefox (Yarn) Source: https://wxt.dev/guide/essentials/publishing Commands to install dependencies and create a Firefox-compatible ZIP archive using Yarn. ```sh yarn yarn zip:firefox ``` -------------------------------- ### Install and Zip for Firefox (NPM) Source: https://wxt.dev/guide/essentials/publishing Commands to install dependencies and create a Firefox-compatible ZIP archive using NPM. ```sh npm i npm run zip:firefox ``` -------------------------------- ### Install and Zip for Firefox (PNPM) Source: https://wxt.dev/guide/essentials/publishing Commands to install dependencies and create a Firefox-compatible ZIP archive using PNPM. ```sh pnpm i pnpm zip:firefox ``` -------------------------------- ### ready Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks Called after WXT modules are initialized, when the WXT instance is ready to be used. `wxt.server` isn't available yet, use `server:created` to get it. ```APIDOC ## ready ### Description Called after WXT modules are initialized, when the WXT instance is ready to be used. `wxt.server` isn't available yet, use `server:created` to get it. ### Parameters #### Parameters - **wxt**: [`Wxt`](/api/reference/wxt/interfaces/wxt) - The configured WXT object ``` -------------------------------- ### Create New Project (NPM) Source: https://wxt.dev/guide/installation Use this command to create a new project directory and initialize it with NPM. ```sh cd my-project npm init ``` -------------------------------- ### Get Translation using i18n Object Source: https://wxt.dev/i18n Import and use the auto-imported `i18n` object to get a translation for 'helloWorld'. ```ts import { i18n } from '#i18n'; i18n.t('helloWorld'); // "Hello world!" ``` -------------------------------- ### wxt init Source: https://wxt.dev/api/cli/wxt-init Initializes a new WXT project by scaffolding the necessary files and configurations. ```APIDOC ## wxt init ### Description Initializes a new WXT project by scaffolding the necessary files and configurations. This command is the starting point for creating a new browser extension using the WXT framework. ### Method CLI Command ### Endpoint N/A (CLI Command) ### Parameters This command does not take any explicit parameters. It typically prompts the user for project details. ### Request Example ```bash wxt init ``` ### Response Upon successful execution, a new WXT project directory is created with the standard project structure and configuration files. ``` -------------------------------- ### OutputAsset fileName example Source: https://wxt.dev/llms-full.txt The 'fileName' property for an OutputAsset represents its relative path within the output directory. For example, 'icons/16.png'. ```typescript "icons/16.png" ``` -------------------------------- ### runner Source: https://wxt.dev/api/reference/wxt/interfaces/InlineConfig Configure browser startup. Deprecated: Use `webExt` instead. ```APIDOC ## runner ### Description Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file. ### Type [`WebExtConfig`](/api/reference/wxt/interfaces/webextconfig) ### Deprecated Use `webExt` instead. Same option, just renamed. ``` -------------------------------- ### MV2 Manifest Example Source: https://wxt.dev/guide/essentials/config/manifest Example of a generated MV2 manifest based on the provided MV3 configuration. Note the 'browser_action' and simplified 'web_accessible_resources'. ```json { "manifest_version": 2, // ... "browser_action": { "default_title": "Some Title" }, "web_accessible_resources": ["icon/*.png"] } ``` -------------------------------- ### Directory Entrypoint Example Source: https://wxt.dev/guide/essentials/entrypoints Defines a directory entrypoint named 'background' within the 'entrypoints/' directory, with an 'index.ts' file inside. ```html 📂 background/ 📄 index.ts ``` -------------------------------- ### Install and Configure a WXT Module Source: https://wxt.dev/guide/essentials/wxt-modules Install a published WXT module from NPM and add its package name to the 'modules' array in your wxt.config.ts file. ```typescript import { defineConfig } from 'wxt'; export default defineConfig({ modules: ['@wxt-dev/auto-icons'], }); ``` -------------------------------- ### Add `wxt prepare` to postinstall Script Source: https://wxt.dev/guide/essentials/config/auto-imports Ensure your editor recognizes auto-imported variables by adding `wxt prepare` to your `postinstall` script in `package.json`. ```jsonc // package.json { "scripts": { "postinstall": "wxt prepare", }, } ``` -------------------------------- ### MV3 Manifest Example Source: https://wxt.dev/guide/essentials/config/manifest Example of a generated MV3 manifest based on the provided MV3 configuration. It directly uses 'action' and the structured 'web_accessible_resources'. ```json { "manifest_version": 3, // ... "action": { "default_title": "Some Title" }, "web_accessible_resources": [ { "matches": ["*://*.google.com/*"], "resources": ["icon/*.png"] } ] } ``` -------------------------------- ### Install UnoCSS for WXT Source: https://wxt.dev/llms-full.txt Install the UnoCSS package and its WXT integration using npm, pnpm, yarn, or bun. This prepares your project to use UnoCSS for styling. ```sh npm i --save-dev @wxt-dev/unocss unocss pnpm i -D @wxt-dev/unocss unocss yarn add --dev @wxt-dev/unocss unocss bun add -D @wxt-dev/unocss unocss ``` -------------------------------- ### wxt prepare CLI Options Source: https://wxt.dev/api/cli/wxt-prepare Lists the available options for the `wxt prepare` command, such as configuration file selection, debug mode, and log level. These options control the preparation process. ```bash Options: -c, --config use specified config file --debug enable debug mode --level specify log level ("silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose") -h, --help Display this message ``` -------------------------------- ### Install @wxt-dev/auto-icons Source: https://wxt.dev/llms-full.txt Install the `@wxt-dev/auto-icons` package as a development dependency using npm, pnpm, yarn, or bun. This package helps generate extension icons automatically. ```sh npm i --save-dev @wxt-dev/auto-icons pnpm i -D @wxt-dev/auto-icons yarn add --dev @wxt-dev/auto-icons bun add -D @wxt-dev/auto-icons ``` -------------------------------- ### wxt prepare Source: https://wxt.dev/api/cli/wxt-prepare Prepares the project for building and deployment. This command ensures all necessary configurations and assets are in place before the build process begins. ```APIDOC ## wxt prepare ### Description Prepares the project for building and deployment. This command ensures all necessary configurations and assets are in place before the build process begins. ### Usage ```bash wxt prepare [options] ``` ### Options This command does not have any specific options documented in the provided source. ``` -------------------------------- ### Firefox Extension Installation via WebDriver BiDi Source: https://wxt.dev/llms-full.txt WXT utilizes the WebDriver BiDi protocol to install extensions in Firefox. This involves connecting to a WebSocket and exchanging messages. ```javascript console.log('Using WebDriver BiDi protocol for Firefox') ``` -------------------------------- ### Ready Hook Example Source: https://wxt.dev/api/reference/wxt/interfaces/WxtHooks The `ready` hook is called after WXT modules are initialized, when the WXT instance is ready to be used. Note that `wxt.server` is not yet available at this stage. ```typescript wxt.hooks.hook('ready', (wxt) => { // WXT instance is ready }); ```