在使用vue3+vite創建新的工程時,在新增.vue文件時會出現Cannot find module 'vue'這個錯誤。
只需要我們在項目中的.d.ts文件中添加以下代碼即可
declare module '*.vue' {import { defineComponent } from 'vue';const component: ReturnType<typeof defineComponent>;export default component;
}
在使用vue3+vite創建新的工程時,在新增.vue文件時會出現Cannot find module 'vue'這個錯誤。
只需要我們在項目中的.d.ts文件中添加以下代碼即可
declare module '*.vue' {import { defineComponent } from 'vue';const component: ReturnType<typeof defineComponent>;export default component;
}
本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。 如若轉載,請注明出處:http://www.pswp.cn/pingmian/76435.shtml 繁體地址,請注明出處:http://hk.pswp.cn/pingmian/76435.shtml 英文地址,請注明出處:http://en.pswp.cn/pingmian/76435.shtml
如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!