Duplicate route names with prefix_and_default strategy
See original GitHub issueVersion
Reproduction link
https://codesandbox.io/s/ql7wx2mvk6
Steps to reproduce
- Configure nuxt-i18n module with these settings:
[
"nuxt-i18n",
{
locales: [
{ code: "pt", iso: "pt-PT", file: "pt.json" },
{ code: "us", iso: "en-US", file: "en.json" }
],
langDir: "locales/",
lazy: true,
strategy: "prefix_and_default",
defaultLocale: "us"
}
]
- Load the root path.
- Look at the console (the server one, at the bottom of the codesandbox UI)
What is expected ?
No warnings about duplicated routes.
What is actually happening?
Getting console warnings:
[vue-router] Duplicate named routes definition: { name: "about___us", path: "/us/about" }
[vue-router] Duplicate named routes definition: { name: "index___us", path: "/us" }
Additional comments?
Appears to be due to using strategy: "prefix_and_default",
setting which creates routes with duplicate names for default locale.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:5
Top Results From Across the Web
Laravel 5.1 - Duplicated prefix while using route groups
Route names are build using both prefix and as if they are defined. That's the reason why you're getting the same prefix. The...
Read more >Prefix Advertisement with Duplicate AS Numbers Overview
When a BGP speaker receives a route that has the speaker's AS number in its AS path, the speaker declares that route to...
Read more >Bug: Duplicate route name, even with different prefix · Issue ...
You need to prefix the route's name by using the as() method in the group. Route.group(() => { Route ...
Read more >Cisco Nexus 9000 Series NX-OS Unicast Routing ...
If you create an ACL named "prefix-list," it cannot be associated with a route map that is created using the match ip address...
Read more >Configure route tables - Amazon Virtual Private Cloud
You can then specify the prefix list as the destination in your route table entry. Every route table contains a local route for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am experiencing this issue as well… any way around it?
Another alternative to the above solution is to use
routes.push({ ...route, path })
instead ofroutes.push({ ...localizedRoute, path })
. This will still create a new route for the default route (which you might want for e.g. SEO purposes) but its name will be set to the base name of the route. For example, acontact
route is currently generated into e.g.contact___en
, but with this change the default locales routes name would just becontact
.Note that
localePath
will still move you to e.g./en/contact
from/contact
, I still need to find a solution to that.