请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

不知道为啥导入npm install vite-plugin-eslint --save-dev 后 引入一直报错

在vite.config.ts 中 import eslint from ‘vite-plugin-eslint’

一直报错Could not find a declaration file for module ‘vite-plugin-eslint’. ‘/Users/fulei/vuetest/vue3-basic1/node_modules/vite-plugin-eslint/dist/index.mjs’ implicitly has an ‘any’ type.
There are types at ‘/Users/fulei/vuetest/vue3-basic1/node_modules/vite-plugin-eslint/dist/index.d.ts’, but this result could not be resolved when respecting package.json “exports”. The ‘vite-plugin-eslint’ library may need to update its package.json or typings.ts(7016)

按照网上办法尝试了半天 要么可以修复这个报错但是运行 npm run dev 的时候会报错
要么就是 报错一直存在 但是可以运行npm run dev

后面用gork3推荐的方法 把 tsconfig.node.json 中的 /* Bundler mode */
“moduleResolution”: “bundler”, 改为"moduleResolution": “node”, 后就不会在报错了 且运行也一切正常

正在回答 回答被采纳积分+3

1回答

张轩 2025-02-26 17:02:24

同学你好

原因就是作者的这个库一直没有适配 vite5

issue 还是 open 的,后面评论是另外一个人 fork 了这个项目,自己修改的版本,看起来这个是和高版本 vite 5 的兼容性问题。这个看起来作者一直都没有维护,这个 issue 也没有修。


可以安装另外一个试试看,https://github.com/nabla/vite-plugin-eslint


0 回复 有任何疑惑可以回复我~
  • 提问者 mholmes #1
    谢谢老师!
    回复 有任何疑惑可以回复我~ 2025-02-26 17:26:03
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号