Skip to content

warn about root paths without a leading slash #2550

Closed
@MatiasOlivera

Description

Version

2.5.3

Reproduction link

https://codesandbox.io/s/6zvmx5lorr

Example

import Vue from "vue";
import Router from "vue-router";

import Home from "../src/views/Home.vue";
import Products from "../src/views/Products.vue";

Vue.use(Router);

const routes = [
  { name: "home", path: "/", component: Home },
  {
    name: "products",
    path: "products", // <-- the problem is here
    component: Products
  }
];

export default new Router({
  routes
});

Steps to reproduce

  1. Open the reproduction
  2. Click on the products link

What is expected?

I spent some time trying to understand what the problem was, so it would be nice to see a warning message telling that the route is invalid because doesn't have the initial slash.

What is actually happening?

The router goes to a route that doesn't exist.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions