添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
强健的红薯  ·  安装Ruby2.6.9,Error ...·  11 月前    · 
伤情的感冒药  ·  Microsoft Entra ...·  11 月前    · 
犯傻的芹菜  ·  Zebra Support Community·  11 月前    · 
俊逸的冲锋衣  ·  极米Z6/Z6X/MX2/Play/X ...·  1 年前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account 引入外部文件报错Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'default' 引入外部文件报错Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'default' laijinxian opened this issue Oct 10, 2020 · 8 comments

我在router/index.ts 文件下引入 外包文件 global.ts; 运行报错 **Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'default**

我在vue2.x 项目中一直是这样用的没问题,但在vue3 + vite 下 就报错了;

router/index.ts

import {createRouter, createWebHashHistory} from'vue-router'
import { vueRouters } from '../utils/global'
// 在 Vue-router新版本中,需要使用createRouter来创建路由
export default createRouter({
  // 指定路由的模式,此处使用的是hash模式
  history: createWebHashHistory(),
  routes: [
    ...vueRouters()

global.ts

export const vueRouters = () => { // todo

Please provide a link to a repo that can reproduce the problem you ran into.

A reproduction is required unless you are absolutely sure that the the problem is obvious and the information you provided is enough for us to understand what the problem is. If a report has only vague description (e.g. just a generic error message) and has no reproduction, it will be closed immediately.

你好 我想问下解决方法是配置 optimizeDeps:{include:[]}吗?vue-class-component一直不支持不知道为什么

import { createRouter, createWebHashHistory } from "vue-router";
import {
    BASE_ROUTE,
} from "@/router/routes.ts";
const router = createRouter({
  end: false,
  history: createWebHashHistory(),
  sensitive: false,
  strict: false,
  routes: BASE_ROUTE
});
export default router;

use like this