File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export { isType } from 'contentlayer/client'
44
55// NOTE During development Contentlayer imports from `.mjs` files to improve HMR speeds.
66// During (production) builds Contentlayer it imports from `.json` files to improve build performance.
7- import { allDocs } from './Doc/_index.mjs'
7+ import allDocs from './Doc/_index.json' assert { type : ' json ' }
88
99export { allDocs }
1010
Original file line number Diff line number Diff line change 1+ "use client"
2+
3+ import { useMDXComponent } from 'next-contentlayer/hooks'
4+
5+ export default function MDXContent ( { code } : { code : string } ) {
6+ const MDX = useMDXComponent ( code )
7+ return < MDX />
8+ }
Original file line number Diff line number Diff line change 11import { allDocs } from 'contentlayer/generated'
22import { notFound } from 'next/navigation'
3- import { useMDXComponent } from 'next-contentlayer/hooks '
3+ import MDXContent from '@/app/components/MDXContent '
44
55export function generateStaticParams ( ) {
66 return allDocs . map ( ( d ) => ( { slug : d . slug } ) )
77}
88
9- export default function DocPage ( { params } : { params : { slug : string } } ) {
10- const doc = allDocs . find ( ( d ) => d . slug === params . slug )
9+ export default async function DocPage ( { params } : { params : Promise < { slug : string } > } ) {
10+ const { slug } = await params
11+ const doc = allDocs . find ( ( d ) => d . slug === slug )
1112 if ( ! doc ) return notFound ( )
1213
13- const MDX = useMDXComponent ( doc . body . code )
14-
1514 return (
1615 < article style = { { maxWidth : 820 , margin : '40px auto' , padding : 16 } } >
1716 < h1 style = { { fontSize : 32 , fontWeight : 800 , marginBottom : 16 } } > { doc . title } </ h1 >
18- < MDX />
17+ < MDXContent code = { doc . body . code } />
1918 </ article >
2019 )
2120}
Original file line number Diff line number Diff line change 44 "private" : true ,
55 "scripts" : {
66 "dev" : " next dev" ,
7- "build" : " next build && contentlayer build " ,
7+ "build" : " next build" ,
88 "export" : " next build && next export" ,
99 "start" : " next start"
1010 },
1111 "dependencies" : {
12- "next" : " 14.2.32 " ,
13- "react" : " ^18.3 .1" ,
14- "react-dom" : " ^18.3 .1" ,
12+ "next" : " ^15.5.3 " ,
13+ "react" : " ^19.1 .1" ,
14+ "react-dom" : " ^19.1 .1" ,
1515 "rehype-autolink-headings" : " ^7.1.0" ,
1616 "rehype-slug" : " ^6.0.0" ,
1717 "remark-gfm" : " ^4.0.1"
1818 },
1919 "devDependencies" : {
20- "@types/node" : " ^20 " ,
21- "@types/react" : " ^18 " ,
22- "@types/react-dom" : " ^18 " ,
20+ "@types/node" : " ^24.3.1 " ,
21+ "@types/react" : " ^19.1.12 " ,
22+ "@types/react-dom" : " ^19.1.9 " ,
2323 "contentlayer" : " ^0.3.4" ,
24- "eslint" : " ^8 " ,
25- "eslint-config-next" : " 14.2.32 " ,
24+ "eslint" : " ^9.35.0 " ,
25+ "eslint-config-next" : " ^15.5.3 " ,
2626 "next-contentlayer" : " ^0.3.4" ,
27- "postcss" : " ^8" ,
28- "tailwindcss" : " ^3.4.1 " ,
29- "typescript" : " ^5"
27+ "postcss" : " ^8.5.6 " ,
28+ "tailwindcss" : " ^3.4.17 " ,
29+ "typescript" : " ^5.6.3 "
3030 }
3131}
You can’t perform that action at this time.
0 commit comments