-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using definePageMeta({ name: ... })
breaks route generation
#2581
Comments
Unfortunately we can't do much to make this work as is, whenever a After trying to find a solution I think I can expand the |
definePageMeta
definePageMeta({ name: ... })
breaks route generation
The proper fix for this issue will require some changes upstream in Nuxt, related issue nuxt/nuxt#24770 |
With nuxt/nuxt#25210 merged, it will be possible to use named routes while using the i18n module once Nuxt v3.10 has been released. You will have to enable the You can already try it out by installing the Nuxt nightly release, I've changed your reproduction to demonstrate here. I'll add this to the docs after Nuxt's release, maybe I'll wait for #2740 to be finished/merged first. After all that is done, I think we'll be able close this issue 😄 |
@BobbieGoede is there an equivalent for i18n? |
Environment
Reproduction
https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-jiqdtm?file=app.vue
Note that only the
/ja
route works here, which is exactly why I'm writing this bug report.Describe the bug
Let's assume the following base Nuxt i18n configuration with all examples below:
A page can be named using:
There are two situations where Nuxt i18n doesn't work nicely with named routes:
customRoutes: 'config'
and route translations forproducts
innuxt.config.ts
:customRoutes: 'page'
and route translations forproducts
insideproducts.vue
usingdefineI18nRoute
:In these scenarios, only last translation route is actually available in the application, so
/de/produkte
in this case. Why? If we take a look at Nuxt DevTools "Virtual Files" tab and go to#build/routes
, we'll find something like this:As we can see here, the page name we specified ourselves takes precedence over the name Nuxt i18n generated. As all these routes will eventually have
{ name: 'products' }
, the last route with that name will become the only one that's actually registered in the router.Not sure what the best solutions would be here. Might be:
#build/routes
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: