Function: fileModule()

View as Markdown
function fileModule<TExports>(path: string): FileModule<TExports>;

Defined in: module.ts:49

Makes a file the document's body, compiled by your bundler and imported only by the pages that render it, eg an MDX file with @mdx-js/rollup. The type parameter is what the file exports.

Parameters

path

string

Relative to the project root, eg file.path.

Returns

FileModule<TExports>

Example

import type { MDXModule } from "mdx/types";

transform: ({ file }) => ({ body: fileModule<MDXModule>(file.path) })