Skip to content

API > wxt/modules > addViteConfig

Function: addViteConfig()

addViteConfig(wxt, viteConfig): void

Merge additional vite config for one or more entrypoint "groups" that make up individual builds. Config in the project's wxt.config.ts file takes precedence over any config added by this function.

Parameters

wxt: Wxt

The wxt instance provided by the module's setup function.

viteConfig: (env) => undefined | UserConfig

A function that returns the vite config the module is adding. Same format as vite in wxt.config.ts.

Returns

Example

ts
export default defineWxtModule((wxt, options) => {
  addViteConfig(wxt, () => ({
    build: {
      sourceMaps: true,
    },
  });
});

Source

packages/wxt/src/modules.ts:105


Generated using typedoc-plugin-markdown and TypeDoc