本文介绍: 在 import 的时候将 import {xxx} fromxxx‘ 改成 import type {xxx} fromxxx使用环境为Vite+Vue3+TypeScript

使用环境为Vite+Vue3+TypeScript

报错信息如下:

Uncaught SyntaxError: The requested modulexx.d.tsdoes not provide an export named ‘CustomRoute’

定义对应ts文件如下:

import { RouteRecordRaw } from "vue-router";

export type CustomRoute = RouteRecordRaw & {
  hidden?: boolean;
};

解决方法
import 的时候将 import {xxx} fromxxx‘  改成 import type {xxx} fromxxx

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注