-
Notifications
You must be signed in to change notification settings - Fork 923
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
[bug] vuepress does not support custom routes #100
Comments
Not entirely sure if this should be considered a bug or feature or both so I went with bug since it's impeding my current work on a custom theme. I'd also be more than happy to help on a fix for this if it's deemed worth fixing/adding support to Vuepress for custom routes. |
See #69 Of course we can avoid this error, but if you add routes dynamically, the page is not possible to be pre-rendered during build. So it is not a recommended usage. We'll add some examples in documentation for theme development |
After some investigation, I find this is kind of a "bug" and can be fixed 🤔 But adding dynamic routes is still not recommended, unless you know what's the drawback. |
@meteorlxy Thanks for looking into this! That other issue is also really useful.
I also think adding some examples about dynamic pages to the documentation would be a great idea to help guide others away from dynamic routes or at least advice them that there is most likely a better solution for what they may be trying to do. |
Bug report
Description
Since Vuepress exposes the
Router
to clients inclientAppEnhance
files, it should be safe to assume that all APIs pertaining to it should be usable, such as, adding routes on-the-fly with Router.addRoute. Vuepress does make this do-able; however, at runtime when trying to navigate to the newly added routes an unexpected error is thrown from Vuepress' custom router resolve guard due to Vuepress not registering the new routes' component as apagesComponent
.Steps to reproduce
clientAppEnhance.js
with following body:Layout.vue
, provide aRouterLink
:The router reproduction was to confirm that
vue-router@v4
does properly support aliases, which is my exact use case. The git repo shows that this issue is triggered regardless if it's an alias or separate path.Expected behavior
Vuepress shouldn't impede custom navigation.
Screenshots
Environment info
vuepress info
:The text was updated successfully, but these errors were encountered: