Skip to content

vue router issue with vite - Error: Couldn't resolve component "default" at "/notFound" #719

@ShenQingchuan

Description

@ShenQingchuan

Version

4.0.3

Reproduction link

https://github.com/ShenQingchuan/vite-vuerouter-issue-repo

Steps to reproduce

Please see my reproduction repo: https://github.com/ShenQingchuan/vite-vuerouter-issue-repo

  1. install dependencies with yarn/npm
  2. yarn dev
  3. type some unknown URL path just like "http://localhost:3000/xxxyyyzzz", anything not involved in src/router.ts
  4. open Chrome DevTools --> go to Console Tab
  5. you can see a warning: vue-router.a68108b7.js:73 [Vue Router warn]: Unexpected error when starting the router: Error: Couldn't resolve component "default" at "/notFound" at vue-router.a68108b7.js:1982

What is expected?

expect the error path should redirect to /notFound

What is actually happening?

From the information in Chrome DevTools Network panel,
the not-found.vue is actually loaded, but the component seems can not be rendered...

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