Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

找不到模块“@wangeditor/editor-for-vue”或其相应的类型声明 #5673

Open
zkyeu opened this issue Aug 28, 2023 · 8 comments
Open

Comments

@zkyeu
Copy link

zkyeu commented Aug 28, 2023

Vue3原封不动的copy 代码,运行的时候报错啊。提示标题样子

@zhuangzhuang-zhuangzhuang

你好可以尝试在项目根目录下新建env.d.ts文件并写入
declare module '*.vue' {
import { DefineComponent } from 'vue';
const Component: DefineComponent<{}, {}, any>;
export default Component;
}

@herozzm
Copy link

herozzm commented Sep 4, 2023

declare module '*.vue' {
import { DefineComponent } from 'vue';
const Component: DefineComponent<{}, {}, any>;
export default Component;
}

我也遇到了这个问题,提示:

无法找到模块“@wangeditor/editor-for-vue”的声明文件。“e:/vue3/vue-project/node_modules/@wangeditor/editor-for-vue/dist/index.esm.js”隐式拥有 "any" 类型。

已经写入了你的内容也不行

@zkyeu
Copy link
Author

zkyeu commented Sep 4, 2023

我又安装了另一个依赖就可以了。
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
貌似需要俩

@2xx
Copy link

2xx commented Dec 29, 2023

我的做法是:
@wangEditor / editor-for-vue / dist /package.json 文件中 exports 这一配置项目全部删掉
然后重启 vs code

@yisuanwl
Copy link

declare module '@wangeditor/editor-for-vue' {
const Editor: any;
const Toolbar: any;
type IEditorConfig = any;
}

@Ttou
Copy link

Ttou commented Apr 23, 2024

其实是 types 忘写了,直接改包

image

@zhuman1993
Copy link

这个问题官方什么时候能出个修复版本啊

@cycleccc
Copy link

@zhuman1993 我发布了修复版本,仅仅添加了d.ts文件。
执行以下命令即可安装(pnpm、yarn同理)

npm i @wangeditor-next/editor-for-vue

最好带上5.1.12的版本后缀,

npm i @wangeditor-next/editor-for-vue@5.1.12

因为后续更新版本修复 wangeditor/core 其它 bug 后可能和现有的 wangeditor/core 不适配。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants