astrolicious / i18n

Yet another i18n integration for Astro with server and client utilities, type safety and translations built-in.
https://astro-i18n.netlify.app/
MIT License
48 stars 3 forks source link

Error on build command with sitemap to true #12

Closed layout-ch closed 5 months ago

layout-ch commented 5 months ago

Hey, I get this error : [AstroUserError] This situation should never occur (a corresponding routeData should always be found)

Whenever I'm trying to build the website. It only occurs when I have sitemap to true so I guess the problem comes from there.

I did a small demo to reproduce the error at : https://github.com/layout-ch/error-demo/

Steps to reproduce :

  1. yarn install
  2. npm run build

Thanks in advance for your help ! 🙏🏼

florian-lefebvre commented 5 months ago

Thanks for the minimal repro! I'll have a look tomorrow

layout-ch commented 5 months ago

I think I found what the problem was, when the slug is uppercase, it crashes. Turned all of my routes to lowercase and now it works !

florian-lefebvre commented 5 months ago

I'm going to check if I have any logic involving downcasing, thanks for reporting

EDIT: there are not any

florian-lefebvre commented 5 months ago

Alright so on RouteData I'm using route but looks like I should be using pathname which preserves casing

florian-lefebvre commented 5 months ago

Apparently it's better to use generate and pass params if it's dynamic. We can check if it's dynamic if at least one segment has dynamic: true