API > wxt/modules > addWxtPlugin
Function: addWxtPlugin()
addWxtPlugin(
wxt,plugin,apply?):void
Add a runtime plugin to the project. In each entrypoint, before executing the main function, plugins are executed.
Parameters
▪ wxt: Wxt
The wxt instance provided by the module's setup function.
▪ plugin: string
An import from an NPM module, or an absolute file path to the file to load at runtime.
▪ apply?: (entrypoint) => boolean
Optional. Return true to load the plugin in the given entrypoint. Defaults to loading the plugin in every entrypoint.
Returns
Example
ts
export default defineWxtModule((wxt) => {
addWxtPlugin(
wxt,
'wxt-module-analytics/background-plugin',
(entrypoint) => entrypoint.type === 'background',
);
});Source
packages/wxt/src/modules.ts:145
Generated using typedoc-plugin-markdown and TypeDoc