使用的环境为Vite+Vue3+TypeScript。
报错信息如下:
Uncaught SyntaxError: The requested module 'xx.d.ts' does not provide an export named 'CustomRoute'
定义的对应的ts文件如下:
import { RouteRecordRaw } from "vue-router";
export type CustomRoute = RouteRecordRaw & {
hidden?: boolean;
};
解决方法:
在 import 的时候将 import {xxx} from 'xxx' 改成 import type {xxx} from 'xxx'
博客介绍了在Vite+Vue3+TypeScript环境下遇到的报错,即请求的模块 'xx.d.ts' 未提供名为 'CustomRoute' 的导出。并给出解决方法,将 import {xxx} from 'xxx' 改成 import type {xxx} from 'xxx'。
2077

被折叠的 条评论
为什么被折叠?



