学海无涯

导航

Vue3 常见错误

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

【解决】

vue-router的配置文件:

方案一:
import * as VueRouter from 'vue-router'
import routes from './routers'

const router = VueRouter.createRouter({
  history: VueRouter.createWebHashHistory(),
  routes
})

方案二:
import {createRouter, createWebHashHistory} from 'vue-router'
import routes from './routers'

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

 参考:https://blog.csdn.net/Dorothy1224/article/details/120011513 

 

posted on 2023-03-02 18:06  宁静致远.  阅读(1716)  评论(0编辑  收藏  举报