Skip to content

Dynamic routes do not get generated with build #160

Closed
@mdaffin

Description

@mdaffin

You have access to the route via .vuepress/enhanceApp.js and can add extra routes such as:

export default ({ Vue, router, options }) => {
  router.addRoutes([
    { path: '/test', redirect: '/' }
  ])
}

or

const Test = () => import("./Test");

export default ({ Vue, options, router }) => {
  router.addRoutes([
    { path: "/test", component: Test }
  ]);
};

And they work as expected when you run it is dev mode vurepress dev site. But when building the app vurepress build site the added routes do not get generated/prerendered, resulting in a 404 when trying to load the route for the first time.

As far as I can tell there is no other way to add routes to the generated list of routes which means that routes cannot be added dynamically via the site or themes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    version: nextPlanned to do or already included in the next(1.0.0) version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions