当前位置: 首页 > 知识库问答 >
问题:

vue.js - vite打包ts编译报错TS2688: Cannot find type definition file for ''该怎么排除解决?

柯轶
2024-03-07

打包时执行 "vue-tsc && vite build" 报错:

error TS2688: Cannot find type definition file for ''.  The file is in the program because:    Entry point for implicit type library ''

依赖版本如下:

 "dependencies": {    "@vueuse/core": "^10.5.0",    "ant-design-vue": "4.x",    "pinia": "^2.1.6",    "sass": "^1.69.2",    "vue": "^3.3.4",    "vue-router": "^4.2.5"  },  "devDependencies": {    "@types/node": "^20.10.0",    "@typescript-eslint/eslint-plugin": "^6.7.5",    "@typescript-eslint/parser": "^6.7.5",    "@vitejs/plugin-vue": "^4.5.0",    "eslint": "^8.51.0",    "eslint-plugin-vue": "^9.17.0",    "postcss-syntax": "^0.36.2",    "typescript": "^5.4.2",    "unplugin-vue-components": "^0.25.2",    "vite": "^4.5.0",    "vue-tsc": "^1.8.5"  }

tsconfig.json

{  "compilerOptions": {    "baseUrl": "./",    "typeRoots": [      "node_modules/@types", // 默认值      "types"    ],    "paths": {      "@/*": [        "src/*"      ],      "#/*": [        "types/*"      ]    },    "target": "ES2020",    "useDefineForClassFields": true,    "module": "ESNext",    "lib": [      "ES2020",      "DOM",      "DOM.Iterable"    ],    "skipLibCheck": true,    /* Bundler mode */    "moduleResolution": "Node",    "allowImportingTsExtensions": true,    "resolveJsonModule": true,    "isolatedModules": true,    "noEmit": true,    "jsx": "preserve",    /* Linting */    "strict": true,    "noUnusedLocals": true,    "noUnusedParameters": true,    "noFallthroughCasesInSwitch": true  },  "include": [    "src/**/*.ts",    "types/**/*.d.ts",    "src/**/*.tsx",    "src/**/*.vue"  ],  "exclude": [    "node_modules",    "dist",    "**/*.js"  ],  "references": [    {      "path": "./tsconfig.node.json"    }  ]}

因为不知道''(就是'')到底是什么,不知道从何入手,重新拉取了typescript也不行

共有1个答案

邢运良
2024-03-07

把错误处的代码也贴出来

 类似资料: