Skip to content

Commit

Permalink
docs: Add docs around importEntrypoint to relevant functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Sep 3, 2024
1 parent 87fbb1f commit 143b5ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/wxt/src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ export function defineWxtModule<TOptions extends WxtModuleOptions>(
* the output directory. This will speed up project builds since it just has to
* copy some files instead of bundling them.
*
* To extract entrypoint options from a JS/TS file, use
* `wxt.builder.importEntrypoint` (see example).
*
* @param wxt The wxt instance provided by the module's setup function.
* @param entrypoint The entrypoint to be bundled along with the extension.
*
* @example
* export default defineWxtModule((wxt, options) => {
* export default defineWxtModule(async (wxt, options) => {
* const entrypointPath = "/path/to/my-entrypoint.ts";
* addEntrypoint(wxt, {
* type: "unlisted-page",
* name: "changelog",
* inputPath: "wxt-module-changelog/index.html"
* type: "content-script",
* name: "some-name",
* inputPath: entrypointPath,
* outputDir: wxt.config.outputDir,
* options: {},
* options: await wxt.builder.importEntrypoint(entrypointPath),
* });
* });
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/wxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,9 @@ export interface WxtHooks {
) => HookResult;
/**
* Called once all entrypoints have been loaded from the `entrypointsDir`.
* Use `wxt.builder.importEntrypoint` to load entrypoint options from the
* file, or manually define them.
*
* @param wxt The configured WXT object
* @param entrypoints The list of entrypoints to be built
*/
Expand Down

0 comments on commit 143b5ac

Please sign in to comment.