Vue3 Vuerouter4 addRoute issue #2026
Unanswered
focussing
asked this question in
Help and Questions
Replies: 1 comment
-
are you solve? if you don't solve try this
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
My app uses routes from a database. In the
main.js
file I need anawait getRoutes
call to this database to retrieve all routes. That works perfectly in development.When building for production an error message about top level await arrives, which is documented; I don't build for esnext.
So I only use only
/
and a 'fetch-all' error route inmain.js
and the rest in my navbar in which theawait getRoutes
is done.This works when I click in the navbar, however when I type the path in the browser address bar (like
/products
) only it does not show the correct page but the error page. Only when I add /products as static route in main.js and type it in the address bar it works.My conclusion is that all dynamically added routes cannot be typed in the address bar.
How can this be fixed?
I have installed all latest packages:
Beta Was this translation helpful? Give feedback.
All reactions