Vite
Use Fumadocs MDX with Vite
Setup
The plugin works with React Router, TanStack Start, Waku and other Vite apps. Next.js has its own setup. Astro uses its own content collections with @fumadocs/astro instead of Fumadocs MDX.
Installation
npm i fumadocs-mdx fumadocs-core @types/mdxAdd the Vite plugin:
import { defineConfig } from 'vite';
import { reactRouter } from '@react-router/dev/vite';
import { fumadocsMdx } from 'fumadocs-mdx/vite';
export default defineConfig({
plugins: [
fumadocsMdx(),
reactRouter(),
],
});Integrate with Fumadocs
Create a lib/source.ts file:
import { defineDocs } from 'fumadocs-mdx/macro';
import { loader } from 'fumadocs-core/source';
const docs = defineDocs({
dir: 'content/docs',
});
export const source = loader({
baseUrl: '/docs',
source: docs.toFumadocsSource(),
});Done
You can now write content in content/docs folder.
What is Next?
How is this guide?
