element-plus语言包引入后打包报错

来源:4-3 vue-i18n实现网站全局国际化

weixin_慕后端5451418

2022-11-11

图片描述
老师 是这样引入的 build打包的时候报错

Could not find a declaration file for module ‘element-plus/dist/locale/en.js’. ‘D:/aCode/ssrvue3/myProject/node_modules/element-plus/dist/locale/en.js’ implicitly has an ‘any’ type.
If the ‘element-plus’ package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module 'element-plus/dist/locale/en.js';

请问我需要怎么解决这个问题呢
这个是项目地址:https://gitee.com/pankrati/ssrvue3

写回答

1回答

weixin_慕后端5451418

提问者

2022-11-11

问题解决了 需要在src目录下新建 declaration.d.ts  文件

declare module 'element-plus/dist/locale/zh-cn'

declare module 'element-plus/dist/locale/en'


加上这两条就可以了

1
0

Vue3+TS打造SSR网站应用,0到1实现服务端渲染

教你一套前端技术组合拳,Get全套网站优化解决方案

368 学习 · 192 问题

查看课程