项目使用的是vite2来搭建。
ref等报错
yarn add eslint@7.32.0
yarn add eslint-plugin-vue@8.0.0
参考链接:https://blog.csdn.net/zhanye88/article/details/121644706
https://blog.csdn.net/qq_43869822/article/details/121637066
https://blog.csdn.net/sirodeng/article/details/105431664
import xxx from xxx,编辑器报错
与tscofig.json同目录创建shims.d.ts。填写以下代码
declare module '*.vue' {
import { ComponentOptions } from 'vue'
const componentOptions: ComponentOptions
export default componentOptions
}
重启项目,报错消失。
import path from 'path'报错
//对node进行类型声明
yarn add @types/node -D