Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

addRoutes redirect changes the url but does not load the page #1803

Open
Labels
@ynnelson

Description

  • [ x] I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

enhanceApp.js

export default ({
 Vue, // the version of Vue being used in the VuePress app
 options, // the options for the root Vue instance
 router, // the router instance for the app
 siteData // site metadata
}) => {
 router.addRoutes([
 {
 name:"emailSubscription",
 path:"/views*",
 redirect: to => {
 return to.params.pathMatch //This would output "/dashboards"
 },
 }
 ])
}

What is expected?

When I enter url http://mywebsite.com/views/dashboards I should be redirected to http://mywebsite.com/dashboards. In my config file /dashboards is defined and points to a README.md file.

What is actually happening?

In dev the redirect works like a charm, no problem. When I vuepress build the site the URL gets rewritten, meaning in the browser the URL physically changes but the page always lands on the front page and the appropriate page and components do not load. The redirect does not occur...

Other relevant information

I tried using router.BeforeResolve instead by putting a rewrite rule there for the URL but to no avail, I cannot get URLs to redirect properly.
Also I noticed that after the redirect rewrite the URL but does not load the page any other link on the app I click give me the following error:

image

I don't even know where to begin with this error... I cannot find any useful information anywhere.

  • Output of npx vuepress info in my VuePress project:

Environment Info:
System:
OS: macOS 10.14
CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
Binaries:
Node: 8.10.0 - /var/folders/1d/8krd2vl11v353f787zrj3chr0000gn/T/yarn--1566860988277-0.30996437124819876/node
Yarn: 1.17.3 - /var/folders/1d/8krd2vl11v353f787zrj3chr0000gn/T/yarn--1566860988277-0.30996437124819876/yarn
npm: 6.10.3 - /usr/local/bin/npm
Browsers:
Chrome: 76.0.3809.100
Firefox: Not Found
Safari: 12.0
npmPackages:
@vuepress/core: 1.0.0-alpha.48
@vuepress/theme-default: 1.0.0-alpha.48
vuepress: ^1.0.0-alpha.47 => 1.0.0-alpha.48
npmGlobalPackages:
vuepress: Not Found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /