意思是說找不到對(duì)應(yīng)的模塊“@/views/xxx.vue”或其相應(yīng)的類型聲明
因?yàn)閠s只能解析 .ts 文件,無法解析?.vue文件
解決方法很簡(jiǎn)單,一開始的時(shí)候env.d.ts是空文件,我們可以在項(xiàng)目的env.d.ts中引入如下代碼:
declare module '*.vue' {
import { DefineComponent } from "vue"
const component: DefineComponent<{}, {}, any>
export default component
}
加入上面的代碼,就不報(bào)錯(cuò)了。文章來源:http://www.zghlxwxcb.cn/news/detail-507073.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-507073.html
到了這里,關(guān)于webstorm vue3+ts報(bào)錯(cuò):Cannot find module ‘@/views/xxx.vue‘ or its corresponding type declarations的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!