赞
踩
- 无法找到模块“vite-plugin-eslint”的声明文件。“xxxx”隐式拥有 "any" 类型。
- There are types at 'xxxxx/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包更新时间在一年前,报错原因可能是由于typescript变更导致依赖包package.json不匹配。
看了github上各个大神提出的解决方案,有点看不懂,搞了很久才大致摸索出了,所以分享下
————————————————
【patch-package】修改node_modules下的依赖包源码-CSDN博客
- pnpm i patch-package
-
- pnpm patch vite-plugin-eslint
-
- pnpm patch-commit xxxxx地址
1.复制一份index.js 改为 index.cjs
2.修改package.json文件内容
- "main": "./dist/index.cjs",
- "module": "./dist/index.mjs",
- "types": "./dist/index.d.ts",
- "exports": {
- ".": {
- "require": "./dist/index.cjs",
- "import": "./dist/index.mjs",
- "types": "./dist/index.d.ts"
- }
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。