shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.29k stars 1.24k forks source link

Nextra 3 uses i18n structure, and the MDX file in pages root fails to load. #3121

Open bazijun opened 1 month ago

bazijun commented 1 month ago

Description

I'm experiencing issues with Nextra 3<3.0.0-alpha.31> when using the i18n directory structure. MDX files in the root pages directory are not loading properly.

├─ pages │ ├─ en/ │ ├─ zh/ │ ├─ es/ │ ├─ ru/ │ ├─ test.mdx ❌

Error Message

./src/pages/test.mdx:2:1

Module not found: Can't resolve 'E:/code/capsolver-docs-v3/.next/static/chunks/nextra-page-map-test.mdx.mjs'
  1 | import { HOC_MDXWrapper } from 'nextra/setup-page'
> 2 | import { pageMap } from 'E:/code/capsolver-docs-v3/.next/static/chunks/nextra-page-map-test.mdx.mjs'
    | ^
  3 |
  4 |
  5 | import 'nextra-theme-docs/style.css'

https://nextjs.org/docs/messages/module-not-found

theme.config.tsx

export default {
  i18n: [
    { locale: "en", name: "English" },
    { locale: "zh", name: "简体中文" },
    { locale: "es", name: "Español" },
    { locale: "ru", name: "Россия" },
    { locale: "vi", name: "Tiếng Việt" },
    { locale: "de", name: "Deutsch" },
    { locale: "jp", name: "日本語" },
    { locale: "hi", name: "हिन्दी" },
    { locale: "fr", name: "Français" },
    { locale: "id", name: "Bahasa Indonesia" },
    { locale: "pt", name: "Português" },
  ]
}
dimaMachina commented 4 weeks ago

unfortunately this will be not fixed, until Nextra v4

bazijun commented 4 weeks ago

@dimaMachina But I really need to have a 404 page with Nav and Footer under the root path of pages. Can you give me some suggestions to achieve this requirement? Thank you very much