withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.21k stars 2.44k forks source link

astro build doesn't output right dist files when config i18n fallback #12013

Open yuchenii opened 4 weeks ago

yuchenii commented 4 weeks ago

Astro Info

Astro                    v4.15.6
Node                     v18.20.3
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

  1. Follow this page to add i18n features, and config i18n.fallback en: "zh", more detailed information is on StackBlitz.
  2. After running pnpm build, the dist directory is as follows. There are also en and zh directories under the en directory, this is a bug or my problem
dist
  ├─en
  │    ├─blog
  │    │    └─first-post
  │    │         └─index.html
  │    ├─en
  │    │    └─blog
  │    │         └─first-post
  │    │              └─index.html
  │    ├─index.html
  │    └─zh
  │         └─blog
  │              └─first-post
  │                   └─index.html
  ├─index.html
  └─zh
       └─blog
            └─first-post
                 └─index.html
  1. if comment out the fallback configuration or add prefixDefaultLocale: true to i18n.routing,there will be no problem

What's the expected result?

The dist directory should look like this

dist
  ├─en
  │    └─blog
  │         └─first-post
  │              └─index.html
  ├─index.html
  └─zh
       └─blog
            └─first-post
                 └─index.html

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-1vx29t-fsktjn?file=astro.config.mjs

Participation

github-actions[bot] commented 1 day ago

Hello @yuchenii. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

ematipico commented 1 day ago

I did triage the issue, and I believe you're using the feature incorrectly, or you provided an incorrect reproduction.

Your reproduction has two issues: