MDX: Update dev server initialization for Next.js 15.5.1

This commit is contained in:
Fuma Nama
2025-09-02 16:46:28 +08:00
parent c7cbd4a035
commit 205d92d3a3
2 changed files with 7 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-mdx': patch
---
Update dev server initialization for Next.js 15.5.1
+2 -8
View File
@@ -43,16 +43,10 @@ export function createMDX({
configPath = findConfigFile(),
outDir = '.source',
}: CreateMDXOptions = {}) {
// Next.js performs multiple iteration on the `next.config.js` file
// the first time contains the original arguments of `next dev`
// we only execute on the first iteration
const isDev = process.argv.includes('dev');
const isBuild = process.argv.includes('build');
if ((isDev || isBuild) && process.env._FUMADOCS_MDX !== '1') {
if (process.env._FUMADOCS_MDX !== '1') {
process.env._FUMADOCS_MDX = '1';
void start(isDev, configPath, outDir);
void start(process.env.NODE_ENV === 'development', configPath, outDir);
}
return (nextConfig: NextConfig = {}): NextConfig => {