# importModule

Imports a document's module body, eg a compiled MDX file. Only the pages that call it load the module, and each module is imported once. Safe to import in browser code: it holds no documents. Provided by the tomekit() Vite plugin, or by tomekit/register outside Vite.

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

```ts
const importModule: <TExports>(module: Module<TExports>) => Promise<TExports>;
```

Defined in: [content-modules.ts:27](https://github.com/aayushbtw/tomekit/blob/main/packages/tomekit/src/content-modules.ts#L27)

Imports a document's module body, eg a compiled MDX file. Only the pages that call it load the module, and each module is imported once. Safe to import in browser code: it holds no documents. Provided by the `tomekit()` Vite plugin, or by `tomekit/register` outside Vite.

## Example

```tsx
import type { MDXModule } from "mdx/types";
import { use } from "react";
import type { Module } from "tomekit";
import { importModule } from "tomekit/content-modules";

function Body({ body }: { body: Module<MDXModule> }) {
  const { default: Content } = use(importModule(body));
  return <Content />;
}
```
