Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
MDX `export const metadata` fails to build with webpack in 16.2.0 (regression from 16.1.6) | GoodFirstPicks

MDX `export const metadata` fails to build with webpack in 16.2.0 (regression from 16.1.6)

vercel/next.js 4 comments 10d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Regression in webpack build process for MDX metadata export in Next.js 16.2.0.

AI Summary

The issue involves a regression in Next.js 16.2.0 where exporting metadata from MDX components fails to build with webpack, despite being documented as supported. The same code works with Turbopack and in Next.js 16.1.6. The fix likely requires understanding both MDX and Next.js's webpack configuration.

Issue Description

Link to the code that reproduces this issue

https://github.com/minamicode/my-mdx-repro

To Reproduce

  1. Clone this repo: git clone https://github.com/minamicode/my-mdx-repro
  2. Install dependencies: npm install
  3. Run npm run build
  4. Build fails with the error below

Current vs. Expected behavior

Current behavior Build fails with webpack in Next.js 16.2.0 with the following error: You are attempting to export "metadata" from a component marked with "use client", which is disallowed.

Expected behavior Build succeeds. This pattern is explicitly documented as supported in the Next.js MDX guide: https://nextjs.org/docs/app/guides/mdx The same code builds successfully in:

Next.js 16.1.6 with webpack Next.js 16.2.0 with Turbopack

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:31 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 22.9.0
  npm: 11.10.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.2.0 // Latest available version is detected (16.2.0).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Markdown (MDX), Webpack

Which stage(s) are affected? (Select all that apply)

next build (local), Other (Deployed)

Additional context

This pattern is explicitly documented as supported in the Next.js MDX guide: https://nextjs.org/docs/app/guides/mdx

The bug is webpack-specific — the same code builds successfully with Turbopack in 16.2.0. It also built successfully with webpack in 16.1.6, suggesting this is a regression introduced in 16.2.0.

Workaround: downgrade to [email protected]

GitHub Labels

WebpackMarkdown (MDX)

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • webpack-specific regression
  • requires understanding of MDX and Next.js integration
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno