vue3+vite+typescript出现does not provide an export named ‘xxx’ 解决方法。

在使用TinyMCE富文本组件时,出现以下错误:The requested module ‘/src/main/ts/components/EditorPropTypes.ts?t=1674647216370’ does not provide an export named ‘IPropTypes’。

对应EditorPropTypes.ts中的代码:
export interface IPropTypes {
apiKey: string;
cloudChannel: string;
id: string;
init: EditorOptions;
initialValue: string;
outputFormat: ‘html’ | ‘text’;
inline: boolean;
modelEvents: string[] | string;
plugins: string[] | string;
tagName: string;
toolbar: string[] | string;
modelValue: string;
disabled: boolean;
tinymceScriptSrc: string;
}

解决方法:
import type{ IPropTypes } from ‘./components/EditorPropTypes’;

在import时将import {XXX} from 'XXX’改成import type {XXX} from ‘XXX’
好像vite会出现问题,webpack正常。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。