Skip to content

Commit 565f299

Browse files
ericyangpanclaude
andcommitted
refactor: update MDX plugins for Turbopack compatibility and remove unused dependency
- Convert MDX plugin config to string format for Turbopack compatibility in Next.js 16 - Remove remarkMdxFrontmatter plugin from MDX config - Remove remark-mdx-frontmatter dependency and 4 related packages - Add rewrites() to fix locale-prefixed static assets in dev mode Co-Authored-By: Claude (Pro/zai-org/GLM-4.7) <noreply@anthropic.com>
1 parent c88e31b commit 565f299

File tree

3 files changed

+746
-790
lines changed

3 files changed

+746
-790
lines changed

next.config.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import bundleAnalyzer from '@next/bundle-analyzer'
22
import createMDX from '@next/mdx'
33
import type { NextConfig } from 'next'
44
import createNextIntlPlugin from 'next-intl/plugin'
5-
import rehypeHighlight from 'rehype-highlight'
6-
import remarkFrontmatter from 'remark-frontmatter'
7-
import remarkGfm from 'remark-gfm'
8-
import remarkMdxFrontmatter from 'remark-mdx-frontmatter'
95

106
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts')
117

@@ -91,6 +87,19 @@ const nextConfig: NextConfig = {
9187
ignoreBuildErrors: false,
9288
},
9389

90+
// Rewrites to fix locale-prefixed static assets in dev mode
91+
async rewrites() {
92+
return {
93+
beforeFiles: [
94+
// Rewrite locale-prefixed _next paths to correct paths
95+
{
96+
source: '/:locale/_next/:path*',
97+
destination: '/_next/:path*',
98+
},
99+
],
100+
}
101+
},
102+
94103
// Redirects configuration
95104
async redirects() {
96105
return [
@@ -158,8 +167,14 @@ const nextConfig: NextConfig = {
158167
const withMDX = createMDX({
159168
extension: /\.mdx?$/,
160169
options: {
161-
remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],
162-
rehypePlugins: [rehypeHighlight],
170+
// String-based config for Turbopack compatibility (Next.js 16+)
171+
remarkPlugins: [
172+
'remark-frontmatter', // Parse and hide YAML frontmatter
173+
'remark-gfm', // GitHub Flavored Markdown (tables, task lists, etc.)
174+
],
175+
rehypePlugins: [
176+
'rehype-highlight', // Code syntax highlighting
177+
],
163178
},
164179
})
165180

0 commit comments

Comments
 (0)