Skip to content

API > wxt > InlineConfig

Interface: InlineConfig

Contents

Properties

alias

alias?: Record<string, string>

Add additional paths to the .wxt/tsconfig.json. Use this instead of overwriting the paths in the root tsconfig.json if you want to add new paths.

The key is the import alias and the value is either a relative path to the root directory or an absolute path.

Example

ts
{
   *   "testing": "src/utils/testing.ts"
   * }

Source

packages/wxt/src/types/index.ts:294


analysis

analysis?: object

Type declaration

enabled

enabled?: boolean

Explicitly include bundle analysis when running wxt build. This can be overridden by the command line --analysis option.

Default
ts
false
keepArtifacts

keepArtifacts?: boolean

By default, the stats-*.json artifacts generated during bundle analysis are deleted. Set to true to keep them.

One stats file is output per build step.

Default
ts
false
open

open?: boolean

Set to true to automatically open the stats.html file when the build is finished. When building in CI, the browser will never open.

Default
ts
false
outputFile

outputFile?: string

Name of the output HTML file. Relative to the project's root directory.

Changing the filename of the outputFile also effects the names of the artifacts generated when setting keepArtifacts to true:

  • "stats.html" => "stats-*.json"
  • "stats/bundle.html" => "bundle-*.json"
  • ".analysis/index.html" => "index-*.json"
Default
ts
"stats.html"
template

template?: TemplateType

When running wxt build --analyze or setting analysis.enabled to true, customize how the bundle will be visualized. See rollup-plugin-visualizer for more details.

Default
ts
"treemap"

Source

packages/wxt/src/types/index.ts:238


browser

browser?: string

Explicitly set a browser to build for. This will override the default browser for each command, and can be overridden by the command line --browser option.

Default

ts
"chrome"

Source

packages/wxt/src/types/index.ts:96


configFile

configFile?: string | false

Only available when using the JS API. Not available in wxt.config.ts files

Path to wxt.config.ts file or false to disable config file discovery.

Default

ts
"wxt.config.ts"

Source

packages/wxt/src/types/index.ts:63


debug

debug?: boolean

Set to true to show debug logs. Overriden by the command line --debug option.

Default

ts
false

Source

packages/wxt/src/types/index.ts:69


dev

dev?: object

Config effecting dev mode only.

Type declaration

reloadCommand

reloadCommand?: string | false

Controls whether a custom keyboard shortcut command, Alt+R, is added during dev mode to quickly reload the extension.

If false, the shortcut is not added during development.

If set to a custom string, you can override the key combo used. See Chrome's command docs for available options.

Default
ts
"Alt+R"
server

server?: object

server.hostname

server.hostname?: string

Hostname to run the dev server on.

Default
ts
"localhost"
server.port

server.port?: number

Port to run the dev server on. Defaults to the first open port from 3000 to 3010.

Source

packages/wxt/src/types/index.ts:335


entrypointsDir

entrypointsDir?: string

Default

ts
"${config.srcDir}/entrypoints"

Source

packages/wxt/src/types/index.ts:39


experimental

experimental?: object

Experimental settings - use with caution.

Type declaration

entrypointImporter

entrypointImporter?: "jiti" | "vite-runtime" | "vite-node"

Method used to import entrypoint files during the build process to extract their options.

  • "jiti": Simplest and fastest, but doesn't allow using any imported variables outside the entrypoint's main function
  • "vite-runtime" (unstable): Uses Vite 5.3's new runtime API to import the entrypoints. Automatically includes vite config based on your wxt.config.ts file
  • "vite-node" (unstable): Uses vite-node to import the entrypoints. Automatically includes vite config based on your wxt.config.ts file
See

Side-effect Docs

Default
ts
"jiti"
includeBrowserPolyfill

includeBrowserPolyfill?: boolean

Whether to use webextension-polyfill when importing browser from wxt/browser.

When set to false, WXT will export the chrome global instead of the polyfill from wxt/browser.

You should use browser to access the web extension APIs.

This option will remain experimental until Manifest V2 is dead.

Default
ts
true
Example
ts
export default defineConfig({
  experimental: {
    includeBrowserPolyfill: false
  }
})

Source

packages/wxt/src/types/index.ts:298


filterEntrypoints

filterEntrypoints?: string[]

A list of entrypoint names ("popup", "options", etc.) to build. Will speed up the build if your extension has lots of entrypoints, and you don't need to build all of them to develop a feature.

Source

packages/wxt/src/types/index.ts:49


hooks

hooks?: NestedHooks<WxtHooks>

Project hooks for running logic during the build process.

Source

packages/wxt/src/types/index.ts:365


imports

imports?: false | WxtUnimportOptions

Customize auto-import options. Set to false to disable auto-imports.

For example, to add a directory to auto-import from, you can use:

ts
export default defineConfig({
  imports: {
    dirs: ["some-directory"]
  }
})

Source

packages/wxt/src/types/index.ts:88


logger

logger?: Logger

Override the logger used.

Default

ts
consola

Source

packages/wxt/src/types/index.ts:108


manifest

manifest?: Partial<Omit<WebExtensionManifest, "background" | "chrome_url_overrides" | "devtools_page" | "manifest_version" | "options_page" | "options_ui" | "sandbox">> | Promise<Partial<Omit<WebExtensionManifest, "background" | "chrome_url_overrides" | "devtools_page" | "manifest_version" | "options_page" | "options_ui" | "sandbox">>> | UserManifestFn

Customize the manifest.json output. Can be an object, promise, or function that returns an object or promise.

Source

packages/wxt/src/types/index.ts:113


manifestVersion

manifestVersion?: TargetManifestVersion

Explicitly set a manifest version to target. This will override the default manifest version for each command, and can be overridden by the command line --mv2 or --mv3 option.

Source

packages/wxt/src/types/index.ts:101


mode

mode?: string

Explicitly set a mode to run in. This will override the default mode for each command, and can be overridden by the command line --mode option.

Source

packages/wxt/src/types/index.ts:74


modules

modules?: string[]

List of WXT module names to include. Can be the full package name ("wxt-module-analytics"), or just the suffix ("analytics" would resolve to "wxt-module-analytics").

Source

packages/wxt/src/types/index.ts:371


modulesDir

modulesDir?: string

Default

ts
"${config.srcDir}/modules"

Source

packages/wxt/src/types/index.ts:43


outDir

outDir?: string

Output directory that stored build folders and ZIPs.

Default

ts
".output"

Source

packages/wxt/src/types/index.ts:55


publicDir

publicDir?: string

Directory containing files that will be copied to the output directory as-is.

Default

ts
"${config.root}/public"

Source

packages/wxt/src/types/index.ts:35


root

root?: string

Your project's root directory containing the package.json used to fill out the manifest.json.

Default

ts
process.cwd()

Source

packages/wxt/src/types/index.ts:19


runner

runner?: ExtensionRunnerConfig

Custom runner options. Options set here can be overridden in a web-ext.config.ts file.

Source

packages/wxt/src/types/index.ts:117


srcDir

srcDir?: string

Directory containing all source code. Set to "src" to move all source code to a src/ directory.

After changing, don't forget to move the public/ and entrypoints/ directories into the new source dir.

Default

ts
config.root

Source

packages/wxt/src/types/index.ts:29


transformManifest

transformManifest?: (manifest) => void

Parameters

manifest: WebExtensionManifest

Returns

Deprecated

Use hooks.build.manifestGenerated to modify your manifest instead. This option will be removed in v1.0

Transform the final manifest before it's written to the file system. Edit the manifest parameter directly, do not return a new object. Return values are ignored.

Example

ts
defineConfig({
  // Add a CSS-only content script.
  transformManifest(manifest) {
    manifest.content_scripts.push({
      matches: ["*://google.com/*"],
      css: ["content-scripts/some-example.css"],
    });
  }
})

Source

packages/wxt/src/types/index.ts:237


vite

vite?: (env) => WxtViteConfig | Promise<WxtViteConfig>

Return custom Vite options from a function. See <https://vitejs.dev/config/shared-options.html> .

root, configFile, and mode should be set in WXT's config instead of Vite's.

This is a function because any vite plugins added need to be recreated for each individual build step, incase they have internal state causing them to fail when reused.

Parameters

env: ConfigEnv

Source

packages/wxt/src/types/index.ts:386


zip

zip?: object

Type declaration

artifactTemplate

artifactTemplate?: string

Configure the filename output when zipping files.

Available template variables:

  • {{name}} - The project's name converted to kebab-case
  • {{version}} - The version_name or version from the manifest
  • {{browser}} - The target browser from the --browser CLI flag
  • {{mode}} - The current mode
  • {{manifestVersion}} - Either "2" or "3"
Default
ts
"{{name}}-{{version}}-{{browser}}.zip"
compressionLevel

compressionLevel?: 0 | 1 | 2 | 3 | 9 | 4 | 5 | 6 | 7 | 8

Compression level to use when zipping files.

Levels: 0 (no compression) to 9 (maximum compression).

Default
ts
9
downloadPackages

downloadPackages?: string[]

The Firefox review process requires the extension be buildable from source to make reviewing easier. This field allows you to use private packages without exposing your auth tokens.

Just list the name of all the packages you want to download and include in the sources zip. Usually, these will be private packages behind auth tokens, but they don't have to be.

All packages listed here will be downloaded to in .wxt/local_modules/ and an overrides or resolutions field (depending on your package manager) will be added to the package.json, pointing to the downloaded packages.

DO NOT include versions or version filters. Just the package name. If multiple versions of a package are present in the project, all versions will be downloaded and referenced in the package.json correctly.

Default
ts
[]
Example
ts
// Correct:
["@scope/package-name", "package-name"]

// Incorrect, don't include versions!!!
["@scope/package-name@1.1.3", "package-name@^2"]
excludeSources

excludeSources?: string[]

Minimatch patterns of files to exclude when creating a ZIP of all your source code for Firefox. Patterns are relative to your config.zip.sourcesRoot.

Hidden files, node_modules, and tests are ignored by default.

Example
ts
[
  "coverage", // Include the coverage directory in the `sourcesRoot`
]
includeSources

includeSources?: string[]

Minimatch patterns of files to include when creating a ZIP of all your source code for Firefox. Patterns are relative to your config.zip.sourcesRoot.

This setting overrides excludeSources. So if a file matches both lists, it is included in the ZIP.

Example
ts
[
  "coverage", // Ignore the coverage directory in the `sourcesRoot`
]
name

name?: string

Override the artifactTemplate's {name} template variable. Defaults to the package.json's name, or if that doesn't exist, the current working directories name.

sourcesRoot

sourcesRoot?: string

Root directory to ZIP when generating the sources ZIP.

Default
ts
config.root
sourcesTemplate

sourcesTemplate?: string

Configure the filename output when zipping files.

Available template variables:

  • {{name}} - The project's name converted to kebab-case
  • {{version}} - The version_name or version from the manifest
  • {{browser}} - The target browser from the --browser CLI flag
  • {{mode}} - The current mode
  • {{manifestVersion}} - Either "2" or "3"
Default
ts
"{{name}}-{{version}}-sources.zip"

Source

packages/wxt/src/types/index.ts:118


Generated using typedoc-plugin-markdown and TypeDoc