BuildArtifactsContext #

What a buildArtifacts() handler receives: every built page, a way to write extra files into the output folder, and a way to import a module the build wrote.

Fields #

pagesreadonly PageBuildArtifact[]

Every built page.

emitFile(path: string, content: string | Uint8Array<ArrayBufferLike>): Promise<void>

Writes a file into the output folder; path is relative to it.

importModule<T = unknown>(path: string): Promise<T>

Imports a module the build wrote, by its path in the output folder.

Full type signature
TypeScript
interface BuildArtifactsContext {
  pages: readonly PageBuildArtifact[]
  emitFile: (path: string, content: string | Uint8Array<ArrayBufferLike>) => Promise<void>
  importModule: <T = unknown>(path: string) => Promise<T>
}

Edit this page

Comments