Skip to content

router can't load with vue3 #998

@minyoung90

Description

@minyoung90

Version

4.0.8

Reproduction link

http://no.link

Steps to reproduce

in the ./router/index.ts

import VueRouter from 'vue-router'

const router = VueRouter.createRouter({
  history: VueRouter.createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: {},
    },
    {
      path: '/:catchAll(.*)',
      name: 'NotFound',
      component: {},
    },
  ],
})

export default router

and in the ./main.ts

import { createApp } from 'vue'
import App from './App.vue'
import '@assets/global.css'
import router from './router'

createApp(App)
  .use(router)
  .mount('#app')

and, I run the simple script above, then I got this error

Uncaught SyntaxError: The requested module '/node_modules/.vite/vue-router.js?v=a35f3e34' does not provide an export named 'default'

I used followed dependences
"vue": "^3.0.5",
"vue-router": "^4.0.8"

What is expected?

Just run with no error

What is actually happening?

got error

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