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

src/types/external.ts:206


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
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

src/types/external.ts:177


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

src/types/external.ts:86


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

src/types/external.ts:53


debug

debug?: boolean

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

Default

ts
false

Source

src/types/external.ts:59


entrypointsDir

entrypointsDir?: string

Default

ts
"${config.srcDir}/entrypoints"

Source

src/types/external.ts:39


experimental

experimental?: object

Experimental settings - use with caution.

Type declaration

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

src/types/external.ts:210


imports

imports?: false | Partial<UnimportOptions>

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

src/types/external.ts:78


localesDir

localesDir?: string

Directory containing localization files used for translation.

Default

ts
"${config.srcDir}/locales"

Source

src/types/external.ts:35


logger

logger?: Logger

Override the logger used.

Default

ts
consola

Source

src/types/external.ts:98


manifest

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

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

Source

src/types/external.ts:103


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

src/types/external.ts:91


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

src/types/external.ts:64


outDir

outDir?: string

Output directory that stored build folders and ZIPs.

Default

ts
".output"

Source

src/types/external.ts:45


publicDir

publicDir?: string

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

Default

ts
"${config.root}/public"

Source

src/types/external.ts:29


root

root?: string

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

Default

ts
process.cwd()

Source

src/types/external.ts:16


runner

runner?: ExtensionRunnerConfig

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

Source

src/types/external.ts:107


srcDir

srcDir?: string

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

Default

ts
config.root

Source

src/types/external.ts:23


transformManifest

transformManifest?: (manifest) => void

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.

Parameters

manifest: WebExtensionManifest

Returns

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

src/types/external.ts:176


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

src/types/external.ts:246


zip

zip?: object

Type declaration

artifactTemplate

artifactTemplate?: string

Configure the filename output when zipping files.

Available template variables:

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

ignoredSources?: string[]

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

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

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:

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

Source

src/types/external.ts:108


Generated using typedoc-plugin-markdown and TypeDoc