Skip to content

Add a warning/error if the component for the route is not found/not set #2053

Closed
@serge1peshcoff

Description

@serge1peshcoff

What problem does this feature solve?

I'm writing a Vue.js app using vue-router. I mistyped the 'component' field for route, like that:

const router = new VueRouter({
    mode: 'history',
    routes: [
        // some other routes
        { path: '/dashboard', compoment: DashboardComponent },
        // more components
    ]
});

The result is nothing is rendered on this route. And I've spent 2 hours debugging it because there's no error/warning if the component field is not set.
My suggestion is to throw an error (or at least put a warning to console.log() ), that way it'd be more clear that the user didn't provide a component for render and that's why nothing is rendered.

What does the proposed API look like?

No API changes, just add the error/warning if the component is not set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions