# fileModule

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.

> Every page: https://tomekit.aayush.cv/llms.txt

```ts
function fileModule<TExports>(path: string): FileModule<TExports>;
```

Defined in: [module.ts:49](https://github.com/aayushbtw/tomekit/blob/main/packages/tomekit/src/module.ts#L49)

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`](https://tomekit.aayush.cv/api-tomekit/interfaces/FileModule/index.md)`<TExports>`

## Example

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

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