Skip to content

API > wxt/modules > addEntrypoint

Function: addEntrypoint()

addEntrypoint(wxt, entrypoint): void

Adds a TS/JS file as an entrypoint to the project. This file will be bundled along with the other entrypoints.

If you're publishing the module to NPM, you should probably pre-build the entrypoint and use addPublicAssets instead to copy pre-bundled assets into the output directory. This will speed up project builds since it just has to copy some files instead of bundling them.

Parameters

wxt: Wxt

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

entrypoint: Entrypoint

The entrypoint to be bundled along with the extension.

Returns

Example

ts
export default defineWxtModule((wxt, options) => {
  addEntrypoint(wxt, {
    type: "unlisted-page",
    name: "changelog",
    inputPath: "wxt-module-changelog/index.html"
    outputDir: wxt.config.outputDir,
    options: {},
  });
});

Source

packages/wxt/src/modules.ts:51


Generated using typedoc-plugin-markdown and TypeDoc