Skip to content

Better error message Component type is invalid  #3167

Open
@SimonSiefke

Description

Version

3.1.5

Reproduction link

https://codesandbox.io/s/vue-routing-example-em6dm?file=/router/index.js

Visit the /hello page in the codesandbox reproduction and open the console to see the error message

Steps to reproduce

Setup lazy-loaded routes and make a mistake by forgetting that it must not be an import but a function that returns the import statement

const routes = [
  {
    path: '/',
    name: 'Home',
    component: import(/* webpackChunkName: "Home" */ '../views/Home.vue'),
  }
]

What is expected?

An error message that says the component is not valid (because it is a promise) and that the expected type is a function

What is actually happening?

Vue shows the following error message:

Failed to mount component: template or render function not defined.

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