Cannot find module ‘@element-plus/icons-vue‘. Did you mean to set the ‘moduleResolution‘ option to ‘

使用Vue3+ts+vite 创建了一个新项目,在下载了element-plus/icons-vue 后,导入图标报错:

Cannot find module '@element-plus/icons-vue'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option

此时页面图标可以正常显示

Cannot find module ‘@element-plus/icons-vue‘. Did you mean to set the ‘moduleResolution‘ option to ‘_第1张图片

解决:

Cannot find module ‘@element-plus/icons-vue‘. Did you mean to set the ‘moduleResolution‘ option to ‘_第2张图片
将tsconfig.json中的moduleResolution: "node"

你可能感兴趣的:(vue.js,javascript,前端)