MDX: hotfix Vite bundling

This commit is contained in:
Fuma Nama
2025-12-20 18:40:13 +08:00
parent 5eea869f1b
commit 3a5b077212
2 changed files with 19 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-mdx': patch
---
hotfix Vite bundling
+14 -12
View File
@@ -9,13 +9,6 @@ import { createIntegratedConfigLoader } from '@/loaders/config';
import { createMetaLoader } from '@/loaders/meta';
import indexFile, { IndexFilePluginOptions } from '@/plugins/index-file';
const FumadocsDeps = [
'fumadocs-core',
'fumadocs-ui',
'fumadocs-openapi',
'@fumadocs/base-ui',
];
export interface PluginOptions {
/**
* Generate index files for accessing content.
@@ -71,12 +64,21 @@ export default async function mdx(
if (!options.updateViteConfig) return config;
return mergeConfig(config, {
optimizeDeps: {
exclude: FumadocsDeps,
},
resolve: {
noExternal: FumadocsDeps,
dedupe: FumadocsDeps,
noExternal: [
'fumadocs-core',
'fumadocs-ui',
'fumadocs-openapi',
'@fumadocs/base-ui',
'@fumadocs/ui',
],
// only dedupe for public, non-transitive libs
dedupe: [
'fumadocs-core',
'fumadocs-ui',
'fumadocs-openapi',
'@fumadocs/base-ui',
],
},
} satisfies UserConfig);
},