nextra icon indicating copy to clipboard operation
nextra copied to clipboard

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

Open bazijun opened this issue 1 year ago • 4 comments

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" },
  ]
}

bazijun avatar Aug 15 '24 03:08 bazijun

unfortunately this will be not fixed, until Nextra v4

dimaMachina avatar Aug 15 '24 15:08 dimaMachina

@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

bazijun avatar Aug 16 '24 09:08 bazijun

@bazijun Hi there, would you want to try Nextra 4 with app router support and server side i18n? How to do it I described in https://github.com/shuding/nextra/issues/2600#issuecomment-2385107206

dimaMachina avatar Oct 03 '24 00:10 dimaMachina

Also cc @arno-fukuda

dimaMachina avatar Oct 03 '24 00:10 dimaMachina

Is there any workaround that can serve the /en/ content without locale in url and without a redirect? Google Search Console indexing doesn't like the 307 redirect, but we don't want to change our sitemap to use /en/ as default.

arno-fukuda avatar Oct 22 '24 07:10 arno-fukuda

Nextra 4 was released with new i18n https://the-guild.dev/blog/nextra-4

Closing this issue for now, feel free to share your feedback

dimaMachina avatar Jan 23 '25 20:01 dimaMachina