【前端】vue项目同时引入elementUI和ant-design后,导致打包失败的解决方案。

VUE同时引入elementUI和ant-design后,可正常运行,但会导致打包失败,且在启动时会输出错误语句。

无论组件库是否按需引入,在打包或启动时都会报以下错误:

Subsequent property declarations must have the same type. Property ‘$confirm’ must be of type ‘(modalOptios: ModalOptions) => ModalConfirm’, but here has type ‘ElMessageBoxShortcutMethod’.

Subsequent property declarations must have the same type. Property ‘$message’ must be of type ‘Message’, but here has type ‘ElMessage’.

解决方案:

找到目录: node_modules/element-ui/types/message-box.d.ts

注释图片中的内容


message-box.d.ts

找到目录 node_modules/element-ui/types/message.d.ts

注释图片中的内容

message.d.ts
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容