Skip to content
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

Vue Router "no match found" warning when using path from routeRules in NuxtLink #24112

Closed
lwpinion opened this issue Nov 3, 2023 · 2 comments · Fixed by #25391
Closed

Vue Router "no match found" warning when using path from routeRules in NuxtLink #24112

lwpinion opened this issue Nov 3, 2023 · 2 comments · Fixed by #25391

Comments

@lwpinion
Copy link
Contributor

lwpinion commented Nov 3, 2023

Environment


  • Operating System: Windows_NT
  • Node Version: v18.16.0
  • Nuxt Version: 3.7.4
  • CLI Version: 3.9.0
  • Nitro Version: 2.6.3
  • Package Manager: npm@9.6.1
  • Builder: -
  • User Config: app, build, components, css, devtools, devServer, experimental, hooks, imports, modules, pinia, plugins, routeRules, runtimeConfig, telemetry, vite
  • Runtime Modules: @pinia/nuxt@0.4.11, @nuxt/devtools@0.5.5
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-vppyrh-tbnswt?file=app.vue

Describe the bug

We have started using routeRules consistently for our redirects. Personally, I really like the concise format of the feature.

However, it seems that the routes are generated in a way that Vue Router still deems it necessary to create warnings in the console when using linking to any given path using NuxtLink. We have these rules in place to create simple URLs that redirect to complex search queries on our products page. Likewise, we link to the "simplified" routes in our footer for SEO purposes.

For example, we might have a routeRule like the following:
'/media/backgrounds': { redirect: { to: '/media/filters/category/Backgrounds', statusCode: 301 } },

We use <NuxtLink to="/media/backgrounds">Backgrounds</NuxtLink> in our footer, but receive an error saying:
[Vue Router warn]: No match found for location with path "/media/backgrounds"

I have provided a minimal reproduction that clearly shows what is happening, but please let me know if anymore information is needed.

Thanks!

Additional context

No response

Logs

No response

Copy link

stackblitz bot commented Nov 3, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@naveeng2402
Copy link

Hi @danielroe I'm really interested in fixing the bug, can you guide me in the right direction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants