-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Closed
Closed
Copy link
Labels
SWCRelated to minification/transpilation in Next.js.Related to minification/transpilation in Next.js.TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.
Description
Link to the code that reproduces this issue
https://github.com/katanabe/nextjs-mdx-multibyte-bug
To Reproduce
- Clone the reproduction repo
- Run
npm install - Run
npm run build
The MDX file (app/test/page.mdx) contains Japanese text with full-width parentheses:
export const metadata = {
title: "Test",
};
# Test
これはテスト(サンプル)です。The issue is triggered by multibyte characters in the MDX body (e.g., ()), not by export const metadata content.
Current vs. Expected behavior
Current behavior:
Build fails with SWC panic:
thread '<unnamed>' panicked at swc_common-18.0.0/src/source_map.rs:657:62:
byte index 88 is not a char boundary; it is inside '(' (bytes 87..90)
Expected behavior:
Build should succeed, as it does in Next.js 16.0.10.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin 25.1.0
Available memory (MB): 65536
Available CPU cores: 12
Binaries:
Node: 24.11.1
npm: 11.3.0
pnpm: 9.15.9
Relevant Packages:
next: 16.1.1
react: 19.0.0
react-dom: 19.0.0
Which area(s) are affected? (Select all that apply)
SWC (minification/transpilation), Turbopack
Which stage(s) are affected? (Select all that apply)
next build (default compiler)
Additional context
Version comparison:
| Version | Result |
|---|---|
| 16.0.10 | ✅ Build succeeds |
| 16.1.0 | ❌ SWC panic |
| 16.1.1 | ❌ SWC panic |
Likely cause:
This regression was likely introduced by the SWC version bump in 16.1.0:
- Bump swc to 48 #86240 (Bump to SWC 48)
- Bump to swc 49 #86689 (Bump to SWC 49)
The issue occurs when Rust string slicing attempts to access a byte index that falls in the middle of a multibyte UTF-8 character (Japanese full-width parenthesis ( is 3 bytes).
Metadata
Metadata
Assignees
Labels
SWCRelated to minification/transpilation in Next.js.Related to minification/transpilation in Next.js.TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.