feat(mdx): move to app router with @next/mdx#8490
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/web-infra @nodejs/nodejs-website Please review the changes when you have a chance. Thank you! 🙏 |
9551c61 to
e64f5af
Compare
|
I'm aware reviewing this many files is impossible. Once I get everything passing, I will make this much more manageable. Right now, the goal was just to be in a position where a feature branch could be opened |
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
casual tuesday 1am (cest): claudio about to chill with YouTube |
|
I think you might wanna go back to that YouTube... this is no where near ready 😅. On the silver lining, through the process of building this, I have several bug reports to send to Next.js. |
📦 Build Size ComparisonSummary
Changes➕ Added Assets (1)
➖ Removed Assets (3)
|
😲I'm still figuring out where this is a good thing or a bad thing :/ |
Imma gonna back to another lifetime 😆 -- Im out! HAHAHA |
🌡️ |
604cbc4 to
4f7c07e
Compare
4f7c07e to
8005acf
Compare
|
If I can get it to work, we should see a substantial size reduction on both the client and server build.... if I can get it to work |
8005acf to
d3d2bd4
Compare
next-mdx-remote with a dedicated MDX content package
next-mdx-remote with a dedicated MDX content packagenext-mdx-remote
abfea51 to
aa2ebec
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the Node.js website's MDX handling from a custom implementation to the Next.js-recommended next-mdx-remote library. The change simplifies the codebase by replacing custom MDX compilation logic with a well-supported third-party solution.
Key changes:
- Migrated from custom
@mdx-js/mdxcompilation tonext-mdx-remote/rsc - Removed dependencies on
@vcarl/remark-headings,remark-reading-time,vfile, andvfile-matter(now handled by next-mdx-remote) - Reorganized MDX-related code into a new
router/directory structure with dedicated plugin files - Simplified page rendering logic across locale and blog routes
Reviewed changes
Copilot reviewed 30 out of 32 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updated dependencies: added next-mdx-remote, moved @mdx-js/mdx to devDependencies, removed custom remark/vfile packages |
| apps/site/package.json | Aligned package changes with lock file |
| apps/site/types/server.ts | Updated type definitions to use inline heading type instead of @vcarl/remark-headings |
| apps/site/types/markdown.ts | Added MarkdownFile type and canonical frontmatter field |
| apps/site/util/array.ts | Added joinNested utility for path segment joining |
| apps/site/router/index.ts | New centralized router logic using next-mdx-remote's compileMDX |
| apps/site/router/render.tsx | Extracted page rendering logic into dedicated component |
| apps/site/router/page.ts | Shared page metadata and viewport generation logic |
| apps/site/router/mdx/plugins/* | Reorganized MDX plugins (table, headings, shiki) into dedicated files |
| apps/site/app/[locale]/page.tsx | Simplified page component using new router infrastructure |
| apps/site/app/[locale]/blog/[cat]/page.tsx | New blog category page using simplified routing |
| apps/site/app/[locale]/download/archive/[version]/page.tsx | Refactored to use new router infrastructure |
| apps/site/next.helpers.mjs | Simplified markdown file retrieval with new CONTENT_ROOT constant |
| apps/site/scripts/* | Updated to use new helper functions and constants |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d74c39e to
fcf2be1
Compare
next-mdx-remotec65cdeb to
97e493e
Compare
97e493e to
fba4b5b
Compare
fba4b5b to
38e642a
Compare
d8c0ccb to
816efcf
Compare
|
|
||
| const WithLayout: FC<WithLayoutProps<Layouts>> = ({ | ||
| layout, | ||
| children, |
There was a problem hiding this comment.
nit: children can be part os ...props spread,
return <LayoutComponent {...props} />
ovflowd
left a comment
There was a problem hiding this comment.
For all that is good, please make two separate branches one containing the changes/file moves and whatnot under pages amd the other being the actual code changes, otherwise reviewing the actual changes becomes impossible.
Make so that:
- main
- feat/mdx-migration-core
- chore/mdx-migration-files
- feat/mdx-migration-core
Something like that.

Fixes #8262
View commits including and after 97e493e to isolate the changes (from the pure Markdown move)
TODO:
next-dataroutes