MDX: Make source config optional in Vite plugin

This commit is contained in:
Fuma Nama
2026-05-08 16:28:55 +08:00
parent b5a051f936
commit 3696a7efc8
73 changed files with 951 additions and 958 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-mdx': patch
---
Make source config optional in Vite plugin
@@ -28,12 +28,11 @@ Add the Vite plugin:
```ts tab="Vite" title="vite.config.ts"
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
plugins: [
// [!code ++]
mdx(MdxConfig),
mdx(),
// ...
],
});
@@ -42,15 +41,13 @@ export default defineConfig({
```ts tab="Waku" title="waku.config.ts"
import { type Config, defineConfig } from 'waku/config';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config.js';
import type { UserConfig } from 'vite';
export default defineConfig({
vite: {
plugins: [
// [!code ++]
mdx(MdxConfig),
tsconfigPaths(),
mdx(),
],
resolve: {
tsconfigPaths: true,
+7 -7
View File
@@ -13,8 +13,8 @@
"start": "next start"
},
"dependencies": {
"@ai-sdk/openai-compatible": "^2.0.46",
"@ai-sdk/react": "^3.0.177",
"@ai-sdk/openai-compatible": "^2.0.47",
"@ai-sdk/react": "^3.0.178",
"@fumadocs/story": "workspace:*",
"@mixedbread/sdk": "^0.64.0",
"@openrouter/ai-sdk-provider": "^2.9.0",
@@ -27,7 +27,7 @@
"@radix-ui/react-tooltip": "^1.2.8",
"@shikijs/transformers": "^4.0.2",
"@takumi-rs/image-response": "^1.1.2",
"ai": "^6.0.175",
"ai": "^6.0.176",
"class-variance-authority": "^0.7.1",
"d3-force": "^3.0.0",
"estree-util-build-jsx": "^3.0.1",
@@ -48,7 +48,7 @@
"lucide-react": "^1.14.0",
"mermaid": "^11.14.0",
"motion": "^12.38.0",
"next": "16.2.5",
"next": "16.2.6",
"next-themes": "^0.4.6",
"octokit": "^5.0.5",
"oxc-transform": "^0.129.0",
@@ -70,15 +70,15 @@
},
"devDependencies": {
"@fumadocs/cli": "workspace:*",
"@next/bundle-analyzer": "16.2.5",
"@next/env": "16.2.5",
"@next/bundle-analyzer": "16.2.6",
"@next/env": "16.2.6",
"@tailwindcss/postcss": "^4.2.4",
"@types/d3-force": "^3.0.10",
"@types/estree": "^1.0.9",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@types/three": "^0.184.1",
+1 -1
View File
@@ -14,7 +14,7 @@
"@astrojs/mdx": "^5.0.4",
"@astrojs/react": "^5.0.4",
"@orama/orama": "^3.1.18",
"astro": "^6.3.0",
"astro": "^6.3.1",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"react": "^19.2.6",
+2 -2
View File
@@ -13,7 +13,7 @@
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"lucide-react": "^1.14.0",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"tailwind-merge": "^3.5.0"
@@ -21,7 +21,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"postcss": "^8.5.14",
+1 -1
View File
@@ -11,7 +11,7 @@
"@fumadocs/content-collections": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6"
},
+1 -1
View File
@@ -13,7 +13,7 @@
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6"
},
+2 -2
View File
@@ -12,14 +12,14 @@
"fumadocs-ui": "workspace:*",
"github-slugger": "^2.0.0",
"html-react-parser": "^6.1.0",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"shiki": "^4.0.2"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"postcss": "^8.5.14",
+2 -2
View File
@@ -13,7 +13,7 @@
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"lucide-react": "^1.14.0",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"tailwind-merge": "^3.5.0"
@@ -21,7 +21,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"postcss": "^8.5.14",
+1 -1
View File
@@ -12,7 +12,7 @@
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6"
},
+2 -2
View File
@@ -14,7 +14,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"lucide-react": "^1.14.0",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"tailwind-merge": "^3.5.0"
@@ -22,7 +22,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"postcss": "^8.5.14",
+2 -2
View File
@@ -13,7 +13,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"lucide-react": "^1.14.0",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"tailwind-merge": "^3.5.0"
@@ -21,7 +21,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"postcss": "^8.5.14",
+1 -1
View File
@@ -13,7 +13,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-obsidian": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6"
},
+1 -1
View File
@@ -14,7 +14,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-openapi": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"shiki": "^4.0.2"
+1 -1
View File
@@ -21,7 +21,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"tailwindcss": "^4.2.4",
+2 -2
View File
@@ -15,14 +15,14 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-python": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"react-dom": "^19.2.6"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"postcss": "^8.5.14",
+1 -1
View File
@@ -24,7 +24,7 @@
"@react-router/dev": "^7.15.0",
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"react-router-devtools": "^6.2.0",
+1 -2
View File
@@ -2,11 +2,10 @@ import { reactRouter } from '@react-router/dev/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
resolve: {
tsconfigPaths: true,
},
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter()],
plugins: [mdx(), tailwindcss(), reactRouter()],
});
+1 -1
View File
@@ -23,7 +23,7 @@
"@react-router/dev": "^7.15.0",
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"react-router-devtools": "^6.2.0",
+1 -2
View File
@@ -2,10 +2,9 @@ import { reactRouter } from '@react-router/dev/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter()],
plugins: [mdx(), tailwindcss(), reactRouter()],
resolve: {
tsconfigPaths: true,
},
+1 -1
View File
@@ -23,7 +23,7 @@
"@react-router/dev": "^7.15.0",
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-rsc": "^0.5.26",
+1 -2
View File
@@ -3,10 +3,9 @@ import rsc from '@vitejs/plugin-rsc';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
plugins: [mdx(MdxConfig), tailwindcss(), reactRouterRSC(), rsc()],
plugins: [mdx(), tailwindcss(), reactRouterRSC(), rsc()],
resolve: {
tsconfigPaths: true,
},
+1 -1
View File
@@ -25,7 +25,7 @@
"@react-router/dev": "^7.15.0",
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"react-router-devtools": "^6.2.0",
+1 -2
View File
@@ -2,10 +2,9 @@ import { reactRouter } from '@react-router/dev/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter()],
plugins: [mdx(), tailwindcss(), reactRouter()],
resolve: {
tsconfigPaths: true,
},
+1 -1
View File
@@ -26,7 +26,7 @@
"@react-router/dev": "^7.15.0",
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"react-router-devtools": "^6.2.0",
+1 -2
View File
@@ -2,10 +2,9 @@ import { reactRouter } from '@react-router/dev/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter()],
plugins: [mdx(), tailwindcss(), reactRouter()],
resolve: {
tsconfigPaths: true,
},
+1 -1
View File
@@ -26,7 +26,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
+1 -1
View File
@@ -10,7 +10,7 @@ export default defineConfig({
port: 3000,
},
plugins: [
mdx(await import('./source.config')),
mdx(),
tailwindcss(),
tanstackStart({
prerender: {
@@ -26,7 +26,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
+1 -1
View File
@@ -25,7 +25,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
+1 -1
View File
@@ -10,7 +10,7 @@ export default defineConfig({
port: 3000,
},
plugins: [
mdx(await import('./source.config')),
mdx(),
tailwindcss(),
tanstackStart({
prerender: {
+1 -1
View File
@@ -28,7 +28,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
@@ -10,7 +10,7 @@ export default defineConfig({
port: 3000,
},
plugins: [
mdx(await import('./source.config')),
mdx(),
tailwindcss(),
tanstackStart({
prerender: {
+1 -1
View File
@@ -28,7 +28,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
+1 -1
View File
@@ -10,7 +10,7 @@ export default defineConfig({
port: 3000,
},
plugins: [
mdx(await import('./source.config')),
mdx(),
tailwindcss(),
tanstackStart({
spa: {
+1 -1
View File
@@ -27,7 +27,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
+1 -1
View File
@@ -13,7 +13,7 @@ export default defineConfig({
tsconfigPaths: true,
},
plugins: [
mdx(await import('./source.config')),
mdx(),
tailwindcss(),
tanstackStart({
prerender: {
+1 -1
View File
@@ -26,7 +26,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
+1 -1
View File
@@ -10,7 +10,7 @@ export default defineConfig({
port: 3000,
},
plugins: [
mdx(await import('./source.config')),
mdx(),
tailwindcss(),
tanstackStart({
prerender: {
+1 -1
View File
@@ -22,7 +22,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"tailwindcss": "^4.2.4",
+1 -2
View File
@@ -1,6 +1,5 @@
import { defineConfig, type Config } from 'waku/config';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config.js';
import tailwindcss from '@tailwindcss/vite';
import type { UserConfig } from 'vite';
@@ -9,6 +8,6 @@ export default defineConfig({
resolve: {
tsconfigPaths: true,
},
plugins: [tailwindcss(), mdx(MdxConfig)],
plugins: [tailwindcss(), mdx()],
} satisfies UserConfig as Config['vite'],
});
+1 -1
View File
@@ -24,7 +24,7 @@
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"tailwindcss": "^4.2.4",
+1 -11
View File
@@ -1,25 +1,15 @@
import { type Config, defineConfig } from 'waku/config';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config.js';
import tailwindcss from '@tailwindcss/vite';
import type { UserConfig } from 'vite';
export default defineConfig({
vite: {
// we do this to avoid Vite from bundling React contexts and cause duplicated contexts conflicts.
optimizeDeps: {
exclude: ['fumadocs-ui', 'fumadocs-core'],
include: [
'fumadocs-ui > unified',
'fumadocs-core > remark',
'fumadocs-core > hast-util-to-jsx-runtime',
],
},
resolve: {
tsconfigPaths: true,
external: ['@takumi-rs/image-response'],
},
plugins: [tailwindcss(), mdx(MdxConfig)],
plugins: [tailwindcss(), mdx()],
} satisfies UserConfig as Config['vite'],
});
+1 -1
View File
@@ -23,7 +23,7 @@
"oxfmt": "^0.48.0",
"oxlint": "^1.63.0",
"rimraf": "^6.1.3",
"turbo": "2.9.9",
"turbo": "2.9.10",
"typescript": "^6.0.3",
"vitest": "^4.1.5"
},
+1 -1
View File
@@ -145,7 +145,7 @@
"@tsdown/css": "^0.22.0",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"fuma-cli": "^0.1.1",
+1 -1
View File
@@ -29,7 +29,7 @@
"types:check": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"basehub": "^9.5.3",
"fuma-cli": "^0.1.1",
+1 -1
View File
@@ -41,7 +41,7 @@
"zod": "^4.4.3"
},
"devDependencies": {
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"tsconfig": "workspace:*",
"tsdown": "0.22.0"
}
+1 -1
View File
@@ -44,7 +44,7 @@
"devDependencies": {
"@content-collections/core": "^0.15.0",
"@content-collections/mdx": "^0.2.2",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"fumadocs-core": "workspace:*",
"tsconfig": "workspace:*",
"tsdown": "0.22.0"
+1 -1
View File
@@ -33,7 +33,7 @@
"@standard-schema/spec": "^1.1.0"
},
"devDependencies": {
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"fuma-content": "^1.2.3",
"fumadocs-core": "workspace:*",
"react-dom": "^19.2.6",
+2 -2
View File
@@ -132,7 +132,7 @@
"@types/js-yaml": "^4.0.9",
"@types/mdast": "^4.0.4",
"@types/negotiator": "^0.6.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"algoliasearch": "5.52.1",
@@ -140,7 +140,7 @@
"image-size": "^2.0.2",
"lucide-react": "^1.14.0",
"negotiator": "^1.0.0",
"next": "16.2.5",
"next": "16.2.6",
"npm-to-yarn": "^3.0.1",
"path-to-regexp": "^8.4.2",
"react-router": "^7.15.0",
+1 -1
View File
@@ -53,7 +53,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"tinyglobby": "^0.2.16",
"tsconfig": "workspace:*",
"tsdown": "0.22.0",
+1 -1
View File
@@ -53,7 +53,7 @@
"@types/estree": "^1.0.9",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"fumadocs-core": "workspace:*",
"mdast-util-mdx": "^3.0.0",
"remark": "^15.0.1",
+1 -1
View File
@@ -45,7 +45,7 @@
},
"devDependencies": {
"@types/mdast": "^4.0.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"fumadocs-core": "workspace:*",
"rimraf": "^6.0.0",
"tsconfig": "workspace:*",
+1 -1
View File
@@ -58,7 +58,7 @@
"@types/estree-jsx": "^1.0.5",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/picomatch": "^4.0.3",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
+1 -1
View File
@@ -44,7 +44,7 @@
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"fumadocs-core": "workspace:*",
"react": "^19.2.6",
+6 -2
View File
@@ -72,12 +72,12 @@
"@types/js-yaml": "^4.0.9",
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/picomatch": "^4.0.3",
"@types/react": "^19.2.14",
"fumadocs-core": "workspace:*",
"mdast-util-directive": "^3.1.0",
"next": "16.2.5",
"next": "16.2.6",
"react": "^19.2.6",
"remark": "^15.0.1",
"remark-directive": "^4.0.0",
@@ -86,6 +86,7 @@
"tsconfig": "workspace:*",
"tsdown": "0.22.0",
"vite": "^8.0.11",
"vitefu": "^1.1.3",
"webpack": "^5.106.2"
},
"peerDependencies": {
@@ -120,5 +121,8 @@
"vite": {
"optional": true
}
},
"inlinedDependencies": {
"vitefu": "1.1.3"
}
}
+25 -10
View File
@@ -1,4 +1,4 @@
import { mergeConfig, type Plugin, type UserConfig } from 'vite';
import { runnerImport, type Plugin } from 'vite';
import { buildConfig } from '@/config/build';
import { ValidationError } from '@/utils/validation';
import { createMdxLoader } from '@/loaders/mdx';
@@ -8,6 +8,7 @@ import { _Defaults, createCore } from '@/core';
import { createIntegratedConfigLoader } from '@/loaders/config';
import { createMetaLoader } from '@/loaders/meta';
import indexFile, { IndexFilePluginOptions } from '@/plugins/index-file';
import { crawlFrameworkPkgs } from 'vitefu';
export interface PluginOptions {
/**
@@ -38,13 +39,15 @@ export interface PluginOptions {
}
export default async function mdx(
config: Record<string, unknown> | Promise<Record<string, unknown>>,
_config?: Record<string, unknown> | Promise<Record<string, unknown>>,
pluginOptions: PluginOptions = {},
): Promise<Plugin> {
const options = applyDefaults(pluginOptions);
const core = createViteCore(options);
const config =
(await _config) ?? (await runnerImport<Record<string, unknown>>(options.configPath)).module;
await core.init({
config: buildConfig(await config),
config: buildConfig(config),
});
const configLoader = createIntegratedConfigLoader(core);
@@ -60,16 +63,28 @@ export default async function mdx(
name: 'fumadocs-mdx',
// needed, otherwise other plugins will be executed before our `transform`.
enforce: 'pre',
config(config) {
async config(config, { command }) {
if (!options.updateViteConfig) return config;
return mergeConfig(config, {
resolve: {
noExternal: ['fumadocs-core', 'fumadocs-ui', 'fumadocs-openapi', '@fumadocs/base-ui'],
// only dedupe for public, non-transitive libs
dedupe: ['fumadocs-core', 'fumadocs-ui', 'fumadocs-openapi', '@fumadocs/base-ui'],
const out = await crawlFrameworkPkgs({
root: process.cwd(),
isBuild: command === 'build',
isFrameworkPkgByName(pkgName) {
if (
pkgName.startsWith('@fumapress/') ||
pkgName.startsWith('@fumadocs/') ||
pkgName.startsWith('fumadocs-')
)
return true;
},
} satisfies UserConfig);
});
return {
ssr: {
noExternal: out.ssr.noExternal,
},
optimizeDeps: out.optimizeDeps,
};
},
async buildStart() {
await core.emit({ write: true });
+1 -1
View File
@@ -18,7 +18,7 @@ export default defineConfig({
bin: './src/bin.ts',
},
deps: {
onlyBundle: [],
onlyBundle: ['vitefu'],
neverBundle: ['webpack', 'bun'],
},
});
+1 -1
View File
@@ -60,7 +60,7 @@
"@types/estree": "^1.0.9",
"@types/js-yaml": "^4.0.9",
"@types/mdast": "^4.0.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"fumadocs-core": "workspace:*",
+1 -1
View File
@@ -73,7 +73,7 @@
"@scalar/openapi-upgrader": "^0.2.7",
"@tailwindcss/oxide": "^4.2.4",
"@types/js-yaml": "^4.0.9",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"fast-content-type-parse": "^3.0.0",
"fumadocs-core": "workspace:*",
+3 -3
View File
@@ -32,10 +32,10 @@
"types:check": "tsc --noEmit"
},
"dependencies": {
"@ai-sdk/react": "^3.0.177",
"@ai-sdk/react": "^3.0.178",
"@fumapress/core": "workspace:*",
"@radix-ui/react-presence": "^1.1.5",
"ai": "^6.0.175",
"ai": "^6.0.176",
"flexsearch": "^0.8.212",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
@@ -48,7 +48,7 @@
"@tailwindcss/oxide": "^4.2.4",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"react": "^19.2.6",
"react-dom": "^19.2.6",
+1 -1
View File
@@ -50,7 +50,7 @@
"devDependencies": {
"@tailwindcss/oxide": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"react": "^19.2.6",
"react-dom": "^19.2.6",
+4 -4
View File
@@ -33,11 +33,11 @@
"types:check": "tsc --noEmit"
},
"dependencies": {
"@ai-sdk/react": "^3.0.177",
"@ai-sdk/react": "^3.0.178",
"@openrouter/ai-sdk-provider": "^2.9.0",
"@radix-ui/react-presence": "^1.1.5",
"@takumi-rs/image-response": "^1.1.2",
"ai": "^6.0.175",
"ai": "^6.0.176",
"chokidar": "^5.0.0",
"class-variance-authority": "^0.7.1",
"commander": "^14.0.3",
@@ -48,7 +48,7 @@
"remark-gfm": "^4.0.1",
"tinyglobby": "^0.2.16",
"unist-util-visit": "^5.1.0",
"unrun": "^0.2.37",
"unrun": "^0.3.0",
"waku": "1.0.0-alpha.10",
"zod": "^4.4.3"
},
@@ -59,7 +59,7 @@
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/picomatch": "^4.0.3",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
+1 -1
View File
@@ -49,7 +49,7 @@
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
+1 -1
View File
@@ -158,7 +158,7 @@
"@tsdown/css": "^0.22.0",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"fuma-cli": "^0.1.1",
+2 -2
View File
@@ -34,12 +34,12 @@
},
"devDependencies": {
"@sanity/client": "^7.22.0",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"fuma-cli": "^0.1.1",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next-sanity": "^12.4.3",
"next-sanity": "^12.4.5",
"react": "^19.2.6",
"sanity": "^5.24.0",
"tsconfig": "workspace:*",
+1 -1
View File
@@ -7,7 +7,7 @@
},
"devDependencies": {
"@fumadocs/cli": "workspace:*",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"tsconfig": "workspace:*"
}
}
+1 -1
View File
@@ -26,7 +26,7 @@
"types:check": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"tsconfig": "workspace:*",
"tsdown": "0.22.0"
+1 -1
View File
@@ -38,7 +38,7 @@
},
"devDependencies": {
"@fastify/deepmerge": "^3.2.1",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/ungap__structured-clone": "^1.2.0",
"@ungap/structured-clone": "^1.3.1",
+1 -1
View File
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@fastify/deepmerge": "^3.2.1",
"@types/node": "^25.6.0",
"@types/node": "^25.6.2",
"postcss-selector-parser": "^7.1.1",
"tailwindcss": "^4.2.4",
"tsconfig": "workspace:*",
+1 -1
View File
@@ -55,7 +55,7 @@
"devDependencies": {
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
+1 -1
View File
@@ -53,7 +53,7 @@
"@types/estree": "^1.0.9",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"@types/node": "25.6.0",
"@types/node": "25.6.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"fumadocs-core": "workspace:*",
+826 -838
View File
File diff suppressed because it is too large Load Diff