API / wxt/modules / addWxtPlugin
Function: addWxtPlugin()
addWxtPlugin(
wxt,plugin,apply?):void
Source: packages/wxt/src/modules/index.ts:145
Add a runtime plugin to the project. In each entrypoint, before executing the main function, plugins are executed.
Parameters
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
void
Example
ts
export default defineWxtModule((wxt) => {
addWxtPlugin(
wxt,
'wxt-module-analytics/background-plugin',
(entrypoint) => entrypoint.type === 'background',
);
});Generated using typedoc-plugin-markdown and TypeDoc